1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 22:25:28 +00:00

Write imports out as debug symbols.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5185 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-16 13:39:00 +00:00
parent cc1326c6c2
commit b7c4a4fe01
3 changed files with 22 additions and 9 deletions

View File

@@ -684,7 +684,7 @@ unsigned GetSymImportId (const SymEntry* S)
unsigned GetSymExportId (const SymEntry* S) unsigned GetSymExportId (const SymEntry* S)
/* Return the export id for the given symbol */ /* Return the export id for the given symbol */
{ {
PRECONDITION (S != 0 && (S->Flags & SF_IMPORT) && S->ExportId != ~0U); PRECONDITION (S != 0 && (S->Flags & SF_EXPORT) && S->ExportId != ~0U);
return S->ExportId; return S->ExportId;
} }

View File

@@ -71,6 +71,9 @@
#define SF_DEFINED 0x4000 /* Defined */ #define SF_DEFINED 0x4000 /* Defined */
#define SF_REFERENCED 0x8000 /* Referenced */ #define SF_REFERENCED 0x8000 /* Referenced */
/* Combined values */
#define SF_REFIMP (SF_REFERENCED|SF_IMPORT) /* A ref'd import */
/* Arguments for SymFind... */ /* Arguments for SymFind... */
#define SYM_FIND_EXISTING 0 #define SYM_FIND_EXISTING 0
#define SYM_ALLOC_NEW 1 #define SYM_ALLOC_NEW 1

View File

@@ -60,16 +60,14 @@
/*****************************************************************************/ /*****************************************************************************/
/* Data */ /* Data */
/*****************************************************************************/ /*****************************************************************************/
/* Combined symbol entry flags used within this module */ /* Combined symbol entry flags used within this module */
#define SF_UNDEFMASK (SF_REFERENCED | SF_DEFINED | SF_IMPORT) #define SF_UNDEFMASK (SF_REFERENCED | SF_DEFINED | SF_IMPORT)
#define SF_UNDEFVAL (SF_REFERENCED) #define SF_UNDEFVAL (SF_REFERENCED)
#define SF_DBGINFOMASK (SF_UNUSED | SF_DEFINED | SF_IMPORT)
#define SF_DBGINFOVAL (SF_DEFINED)
/* Symbol tables */ /* Symbol tables */
SymTable* CurrentScope = 0; /* Pointer to current symbol table */ SymTable* CurrentScope = 0; /* Pointer to current symbol table */
@@ -89,6 +87,20 @@ static unsigned ExportCount = 0; /* Counter for export symbols */
static int IsDbgSym (const SymEntry* S)
/* Return true if this is a debug symbol */
{
if ((S->Flags & (SF_DEFINED | SF_UNUSED)) == SF_DEFINED) {
/* Defined symbols are debug symbols if they aren't sizes */
return !IsSizeOfSymbol (S);
} else {
/* Others are debug symbols if they're referenced imports */
return ((S->Flags & SF_REFIMP) == SF_REFIMP);
}
}
static unsigned ScopeTableSize (unsigned Level) static unsigned ScopeTableSize (unsigned Level)
/* Get the size of a table for the given lexical level */ /* Get the size of a table for the given lexical level */
{ {
@@ -802,8 +814,7 @@ void WriteDbgSyms (void)
Count = 0; Count = 0;
S = SymList; S = SymList;
while (S) { while (S) {
if ((S->Flags & SF_DBGINFOMASK) == SF_DBGINFOVAL && if (IsDbgSym (S)) {
!IsSizeOfSymbol (S)) {
S->DebugSymId = Count++; S->DebugSymId = Count++;
} }
S = S->List; S = S->List;
@@ -817,8 +828,7 @@ void WriteDbgSyms (void)
*/ */
S = SymList; S = SymList;
while (S) { while (S) {
if ((S->Flags & SF_DBGINFOMASK) == SF_DBGINFOVAL && if (IsDbgSym (S)) {
!IsSizeOfSymbol (S)) {
/* Get the expression bits and the value */ /* Get the expression bits and the value */
long ConstVal; long ConstVal;