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)
/* 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;
}

View file

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

View file

@ -60,16 +60,14 @@
/*****************************************************************************/
/* Data */
/* Data */
/*****************************************************************************/
/* Combined symbol entry flags used within this module */
#define SF_UNDEFMASK (SF_REFERENCED | SF_DEFINED | SF_IMPORT)
#define SF_UNDEFVAL (SF_REFERENCED)
#define SF_DBGINFOMASK (SF_UNUSED | SF_DEFINED | SF_IMPORT)
#define SF_DBGINFOVAL (SF_DEFINED)
#define SF_UNDEFVAL (SF_REFERENCED)
/* Symbol tables */
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)
/* Get the size of a table for the given lexical level */
{
@ -802,8 +814,7 @@ void WriteDbgSyms (void)
Count = 0;
S = SymList;
while (S) {
if ((S->Flags & SF_DBGINFOMASK) == SF_DBGINFOVAL &&
!IsSizeOfSymbol (S)) {
if (IsDbgSym (S)) {
S->DebugSymId = Count++;
}
S = S->List;
@ -817,8 +828,7 @@ void WriteDbgSyms (void)
*/
S = SymList;
while (S) {
if ((S->Flags & SF_DBGINFOMASK) == SF_DBGINFOVAL &&
!IsSizeOfSymbol (S)) {
if (IsDbgSym (S)) {
/* Get the expression bits and the value */
long ConstVal;