1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-11 05:29:33 +00:00

Add the parent scope/symbol to the debug symbol attributes.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5094 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-07-31 13:28:54 +00:00
parent 7466b89ed1
commit dd3a841b1a
4 changed files with 23 additions and 0 deletions

View File

@ -849,6 +849,15 @@ void WriteDbgSyms (void)
/* Write the address size */
ObjWrite8 (S->AddrSize);
/* Write the id of the parent. For normal symbols, this is a
* scope (symbol table), for cheap locals, it's a symbol.
*/
if (SYM_IS_STD (ExprMask)) {
ObjWriteVar (S->Sym.Tab->Id);
} else {
ObjWriteVar (S->Sym.Entry->DebugSymId);
}
/* Write the name */
ObjWriteVar (S->Name);

View File

@ -85,6 +85,7 @@ static DbgSym* NewDbgSym (unsigned char Type, unsigned char AddrSize, ObjData* O
D->LineInfos = EmptyCollection;
D->Expr = 0;
D->Size = 0;
D->Parent.Id = ~0UL;
D->Name = 0;
D->Type = Type;
D->AddrSize = AddrSize;
@ -151,6 +152,9 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O)
/* Create a new debug symbol */
DbgSym* D = NewDbgSym (Type, AddrSize, O);
/* Read the id of the owner scope/symbol */
D->Parent.Id = ReadVar (F);
/* Read and assign the name */
D->Name = MakeGlobalStringId (O, ReadVar (F));

View File

@ -55,6 +55,9 @@
/* Forwards */
struct Scope;
/* Debug symbol structure */
typedef struct DbgSym DbgSym;
struct DbgSym {
@ -64,6 +67,11 @@ struct DbgSym {
Collection LineInfos; /* Line infos of definition */
ExprNode* Expr; /* Expression (0 if not def'd) */
unsigned long Size; /* Symbol size if any */
union {
unsigned long Id; /* Id of parent while not resolved */
struct Scope* Scope; /* Parent scope */
struct DbgSym* Sym; /* Parent symbol for cheap locals */
} Parent;
unsigned Name; /* Name */
unsigned char Type; /* Type of symbol */
unsigned char AddrSize; /* Address size of symbol */

View File

@ -663,6 +663,7 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset)
/* Read the data for one symbol */
unsigned Type = ReadVar (F);
unsigned char AddrSize = Read8 (F);
unsigned long Owner = ReadVar (F);
const char* Name = GetString (&StrPool, ReadVar (F));
unsigned Len = strlen (Name);
if (SYM_IS_CONST (Type)) {
@ -684,6 +685,7 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset)
printf (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, 0));
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
AddrSizeToStr (AddrSize));
printf (" Owner:%25lu\n", Owner);
printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
if (SYM_IS_CONST (Type)) {
printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value);