From 4670be0ce1c1c775549e7d4538dcb17218b50d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Henrik=20Sk=C3=A5rstedt?= Date: Fri, 6 Sep 2019 18:02:18 -0700 Subject: [PATCH] Adding a structure to hold one unit of source level debugging --- x65.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/x65.cpp b/x65.cpp index 0c43d91..453ae84 100644 --- a/x65.cpp +++ b/x65.cpp @@ -1161,6 +1161,17 @@ struct ListLine { }; typedef std::vector Listing; +// Source level debugging info that can be saved into linkable object files, this is close to ListLine so possibly combinable. +// this belongs in each section so it can be saved with that into the x65 files or generated if linked +struct SourceDebugEntry { + int source_file_index; // index into Assembler::source_file vector + int address; // local address in section + int size; + int source_file_offset; // can be converted into line/column while linking +}; +typedef std::vector SourceDebug; + + enum SectionType : int8_t { // enum order indicates fixed address linking priority ST_UNDEFINED, // not set ST_CODE, // default type @@ -1220,6 +1231,7 @@ typedef struct Section { // reloc data relocList *pRelocs; // link time resolve (not all sections need this) Listing *pListing; // if list output + SourceDebug *pSrcDbg; // if source level debugging info generated // grouped sections int next_group; // next section of a group of relative sections or -1 @@ -1456,6 +1468,7 @@ public: pairArray labelStructs; pairArray xdefs; // labels matching xdef names will be marked as external + std::vector source_files; // all source files encountered while assembling. referenced by source level debugging std::vector lateEval; std::vector localLabels; std::vector loadedData; // free when assembler is completed