/* 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);
D->LineInfos = EmptyCollection;
D->Expr = 0;
D->Size = 0;
+ D->Parent.Id = ~0UL;
D->Name = 0;
D->Type = Type;
D->AddrSize = AddrSize;
/* 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));
+/* Forwards */
+struct Scope;
+
/* Debug symbol structure */
typedef struct DbgSym DbgSym;
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 */
/* 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)) {
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);