Rearrange debug info output. Add scopes to the debug info.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5117 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-04 15:58:54 +00:00
parent 871873b1ac
commit 2f75733e43
13 changed files with 164 additions and 220 deletions

View File

@@ -41,6 +41,7 @@
#include "fileio.h"
#include "scopes.h"
#include "span.h"
#include "spool.h"
@@ -116,3 +117,45 @@ void ResolveScopes (ObjData* Obj)
void PrintDbgScopes (FILE* F)
/* Output the scopes to a debug info file */
{
unsigned I, J;
/* Print scopes from all modules we have linked into the output file */
unsigned BaseId = 0;
for (I = 0; I < CollCount (&ObjDataList); ++I) {
/* Get the object file */
ObjData* O = CollAtUnchecked (&ObjDataList, I);
/* Output the scopes for this object file */
for (J = 0; J < CollCount (&O->Scopes); ++J) {
const Scope* S = CollConstAt (&O->Scopes, J);
fprintf (F,
"scope\tid=%u,name=\"%s\",type=%u",
BaseId + S->Id,
GetString (S->Name),
S->Type);
/* Print the size if available */
if (S->Size != 0) {
fprintf (F, ",size=%lu", S->Size);
}
/* Print parent if available */
if (S->Parent.Scope) {
fprintf (F, ",parent=%u", BaseId + S->Parent.Scope->Id);
}
/* Terminate the output line */
fputc ('\n', F);
}
/* Increment scope base id */
BaseId += CollCount (&O->Scopes);
}
}