Mark the symbol that is the name of a scope with the size of that scope
(previously only the scope itself had that size). Pass the size of symbols through the object file to the linker. Bump the object file version and adjust object file reading tools (od65, ar65) to this change. Read the size in the linker and output it in the debug info. Bump the minor version number of the debug info. Read the size and allow to access it via the API. Do better version checking for the debug info and try to be smarter when encountering unknown keywords to improve support for newer minor versions. git-svn-id: svn://svn.cc65.org/cc65/trunk@5057 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -65,7 +65,7 @@ void CreateDbgFile (void)
|
||||
}
|
||||
|
||||
/* Output version information */
|
||||
fprintf (F, "version\tmajor=1,minor=1\n");
|
||||
fprintf (F, "version\tmajor=1,minor=2\n");
|
||||
|
||||
/* Clear the debug sym table (used to detect duplicates) */
|
||||
ClearDbgSymTable ();
|
||||
|
||||
@@ -85,7 +85,7 @@ void PrintDbgInfo (ObjData* O, FILE* F)
|
||||
|
||||
/* Print it */
|
||||
fprintf (F,
|
||||
"line\tfile=%u,line=%lu,segment=%u,range=0x%06lX-0x%06lX",
|
||||
"line\tfile=%u,line=%lu,segment=%u,range=0x%lX-0x%lX",
|
||||
LI->File->Id, GetSourceLine (LI), R->Seg->Id,
|
||||
R->Offs, R->Offs + R->Size - 1);
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ static DbgSym* NewDbgSym (unsigned char Type, unsigned char AddrSize, ObjData* O
|
||||
D->Obj = O;
|
||||
D->LineInfos = EmptyCollection;
|
||||
D->Expr = 0;
|
||||
D->Size = 0;
|
||||
D->Name = 0;
|
||||
D->Type = Type;
|
||||
D->AddrSize = AddrSize;
|
||||
@@ -144,7 +145,7 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O)
|
||||
/* Read a debug symbol from a file, insert and return it */
|
||||
{
|
||||
/* Read the type and address size */
|
||||
unsigned char Type = ReadVar (F);
|
||||
unsigned Type = ReadVar (F);
|
||||
unsigned char AddrSize = Read8 (F);
|
||||
|
||||
/* Create a new debug symbol */
|
||||
@@ -160,6 +161,11 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O)
|
||||
D->Expr = LiteralExpr (Read32 (F), O);
|
||||
}
|
||||
|
||||
/* Read the size */
|
||||
if (SYM_HAS_SIZE (D->Type)) {
|
||||
D->Size = ReadVar (F);
|
||||
}
|
||||
|
||||
/* Last is the list of line infos for this symbol */
|
||||
ReadLineInfoList (F, O, &D->LineInfos);
|
||||
|
||||
@@ -219,11 +225,15 @@ void PrintDbgSyms (ObjData* O, FILE* F)
|
||||
|
||||
/* Emit the debug file line */
|
||||
fprintf (F,
|
||||
"sym\tname=\"%s\",value=0x%08lX,addrsize=%s,type=%s\n",
|
||||
"sym\tname=\"%s\",value=0x%lX,addrsize=%s,type=%s",
|
||||
GetString (D->Name),
|
||||
Val,
|
||||
AddrSizeToStr (D->AddrSize),
|
||||
SYM_IS_LABEL (D->Type)? "label" : "equate");
|
||||
if (D->Size != 0) {
|
||||
fprintf (F, ",size=%lu", D->Size);
|
||||
}
|
||||
fputc ('\n', F);
|
||||
|
||||
/* Insert the symbol into the table */
|
||||
InsertDbgSym (D, Val);
|
||||
|
||||
@@ -63,6 +63,7 @@ struct DbgSym {
|
||||
ObjData* Obj; /* Object file that exports the name */
|
||||
Collection LineInfos; /* Line infos of definition */
|
||||
ExprNode* Expr; /* Expression (0 if not def'd) */
|
||||
unsigned long Size; /* Symbol size if any */
|
||||
unsigned Name; /* Name */
|
||||
unsigned char Type; /* Type of symbol */
|
||||
unsigned char AddrSize; /* Address size of symbol */
|
||||
|
||||
@@ -304,6 +304,7 @@ static Export* NewExport (unsigned char Type, unsigned char AddrSize,
|
||||
E->ImpCount = 0;
|
||||
E->ImpList = 0;
|
||||
E->Expr = 0;
|
||||
E->Size = 0;
|
||||
E->LineInfos = EmptyCollection;
|
||||
E->Type = Type;
|
||||
E->AddrSize = AddrSize;
|
||||
@@ -384,6 +385,11 @@ Export* ReadExport (FILE* F, ObjData* O)
|
||||
E->Expr = LiteralExpr (Read32 (F), O);
|
||||
}
|
||||
|
||||
/* Read the size */
|
||||
if (SYM_HAS_SIZE (Type)) {
|
||||
E->Size = ReadVar (F);
|
||||
}
|
||||
|
||||
/* Last is the file position where the definition was done */
|
||||
ReadLineInfoList (F, O, &E->LineInfos);
|
||||
|
||||
@@ -445,7 +451,7 @@ void InsertExport (Export* E)
|
||||
Imp = E->ImpList;
|
||||
while (Imp) {
|
||||
Imp->Exp = E;
|
||||
Imp = Imp->Next;
|
||||
Imp = Imp->Next;
|
||||
}
|
||||
} else {
|
||||
/* Duplicate entry, ignore it */
|
||||
@@ -739,7 +745,7 @@ static void PrintUnresolved (ExpCheckFunc F, void* Data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int CmpExpName (const void* K1, const void* K2)
|
||||
/* Compare function for qsort */
|
||||
{
|
||||
|
||||
@@ -83,6 +83,7 @@ struct Export {
|
||||
unsigned ImpCount; /* How many imports for this symbol? */
|
||||
Import* ImpList; /* List of imports for this symbol */
|
||||
ExprNode* Expr; /* Expression (0 if not def'd) */
|
||||
unsigned long Size; /* Size of the symbol if any */
|
||||
Collection LineInfos; /* Line info of definition */
|
||||
unsigned char Type; /* Type of export */
|
||||
unsigned char AddrSize; /* Address size of export */
|
||||
|
||||
Reference in New Issue
Block a user