From: uz Date: Thu, 18 Aug 2011 10:13:11 +0000 (+0000) Subject: If a symbol is an import, the corresponding export does only have a debug X-Git-Tag: V2.13.3~259 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0077e3718270498c8c3d2c9eeb7e5ac81e5d7658;p=cc65 If a symbol is an import, the corresponding export does only have a debug symbol id if the module contains debug information. git-svn-id: svn://svn.cc65.org/cc65/trunk@5203 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/ld65/dbgsyms.c b/src/ld65/dbgsyms.c index 0bda07971..50c9c654c 100644 --- a/src/ld65/dbgsyms.c +++ b/src/ld65/dbgsyms.c @@ -259,35 +259,6 @@ void PrintDbgSyms (FILE* F) GetString (S->Name), AddrSizeToStr (S->AddrSize)); - /* If this is not an import, output its value and - if we have - * it - the segment. - */ - if (!SYM_IS_IMPORT (S->Type)) { - - SegExprDesc D; - - /* Get the symbol value */ - long Val = GetDbgSymVal (S); - - /* Output it */ - fprintf (F, ",val=0x%lX", Val); - - /* Check for a segmented expression and add the segment id to - * the debug info if we have one. - */ - GetSegExprVal (S->Expr, &D); - if (!D.TooComplex && D.Seg != 0) { - fprintf (F, ",seg=%u", D.Seg->Id); - } - - /* Output the type */ - fprintf (F, ",type=%s", SYM_IS_LABEL (S->Type)? "lab" : "equ"); - - } else { - /* Output the type */ - fputs (",type=imp", F); - } - /* Emit the size only if we know it */ if (S->Size != 0) { fprintf (F, ",size=%u", S->Size); @@ -302,7 +273,10 @@ void PrintDbgSyms (FILE* F) fprintf (F, ",parent=%u", O->SymBaseId + S->OwnerId); } - /* If this is an import, output the id of the matching export */ + /* If this is an import, output the id of the matching export. + * If this is not an import, output its value and - if we have + * it - the segment. + */ if (SYM_IS_IMPORT (S->Type)) { /* Get the import */ @@ -311,12 +285,37 @@ void PrintDbgSyms (FILE* F) /* Get the export from the import */ const Export* Exp = Imp->Exp; - /* If this is not a linker generated symbol, output the debug + /* Output the type */ + fputs (",type=imp", F); + + /* If this is not a linker generated symbol, and the module + * that contains the export has debug info, output the debug * symbol id for the export */ - if (Exp->Obj) { + if (Exp->Obj && OBJ_HAS_DBGINFO (Exp->Obj->Header.Flags)) { fprintf (F, ",exp=%u", Exp->Obj->SymBaseId + Exp->DbgSymId); } + + } else { + + SegExprDesc D; + + /* Get the symbol value */ + long Val = GetDbgSymVal (S); + + /* Output it */ + fprintf (F, ",val=0x%lX", Val); + + /* Check for a segmented expression and add the segment id to + * the debug info if we have one. + */ + GetSegExprVal (S->Expr, &D); + if (!D.TooComplex && D.Seg != 0) { + fprintf (F, ",seg=%u", D.Seg->Id); + } + + /* Output the type */ + fprintf (F, ",type=%s", SYM_IS_LABEL (S->Type)? "lab" : "equ"); } /* Terminate the output line */