diff --git a/src/ld65/dbgfile.c b/src/ld65/dbgfile.c index 1b369169c..4aa64c953 100644 --- a/src/ld65/dbgfile.c +++ b/src/ld65/dbgfile.c @@ -58,6 +58,8 @@ void CreateDbgFile (void) /* Create a debug info file */ { + unsigned I; + /* Open the debug info file */ FILE* F = fopen (DbgFileName, "w"); if (F == 0) { @@ -67,6 +69,34 @@ void CreateDbgFile (void) /* Output version information */ fprintf (F, "version\tmajor=1,minor=2\n"); + /* Output modules */ + for (I = 0; I < CollCount (&ObjDataList); ++I) { + + /* Get this object file */ + const ObjData* O = CollConstAt (&ObjDataList, I); + + /* The main source file is the one at index zero */ + const FileInfo* Source = CollConstAt (&O->Files, 0); + + /* Output the module line */ + fprintf (F, + "module\tid=%u,name=\"%s\",file=%u", + I, + GetObjFileName (O), + Source->Id); + + /* Add library if any */ + if (O->LibName != INVALID_STRING_ID) { + fprintf (F, + ",lib=\"%s\",mtime=0x%08lX", + GetString (O->LibName), + O->MTime); + } + + /* Terminate the output line */ + fputc ('\n', F); + } + /* Output the segment info */ PrintDbgSegments (F); diff --git a/src/ld65/scopes.c b/src/ld65/scopes.c index 93e3d6b0d..561a555de 100644 --- a/src/ld65/scopes.c +++ b/src/ld65/scopes.c @@ -111,9 +111,10 @@ void PrintDbgScopes (FILE* F) const Scope* S = CollConstAt (&O->Scopes, J); fprintf (F, - "scope\tid=%u,name=\"%s\",type=%u", + "scope\tid=%u,name=\"%s\",module=%u,type=%u", BaseId + S->Id, GetString (S->Name), + I, S->Type); /* Print the size if available */