From 2a038ffef9d6e51324b6ec80fa7e780b0d48ad1c Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 18 Aug 2011 16:55:53 +0000 Subject: [PATCH] Output line info for symbol definition and references. git-svn-id: svn://svn.cc65.org/cc65/trunk@5216 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/dbgsyms.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/ld65/dbgsyms.c b/src/ld65/dbgsyms.c index 7c018461b..89f4080d1 100644 --- a/src/ld65/dbgsyms.c +++ b/src/ld65/dbgsyms.c @@ -239,6 +239,22 @@ static long GetDbgSymVal (const DbgSym* D) +static void PrintLineInfo (FILE* F, const Collection* LineInfos, const char* Format) +/* Output an attribute with line infos */ +{ + if (CollCount (LineInfos) > 0) { + unsigned I; + const LineInfo* LI = CollConstAt (LineInfos, 0); + fprintf (F, Format, LI->Id); + for (I = 1; I < CollCount (LineInfos); ++I) { + LI = CollConstAt (LineInfos, I); + fprintf (F, "+%u", LI->Id); + } + } +} + + + void PrintDbgSyms (FILE* F) /* Print the debug symbols in a debug file */ { @@ -277,15 +293,8 @@ void PrintDbgSyms (FILE* F) } /* Output line infos */ - if (CollCount (&S->DefLines) > 0) { - unsigned K; - const LineInfo* LI = CollConstAt (&S->DefLines, 0); - fprintf (F, ",line=%u", LI->Id); - for (K = 1; K < CollCount (&S->DefLines); ++K) { - LI = CollConstAt (&S->DefLines, K); - fprintf (F, "+%u", LI->Id); - } - } + PrintLineInfo (F, &S->DefLines, ",def=%u"); + PrintLineInfo (F, &S->RefLines, ",ref=%u"); /* 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 -- 2.39.5