From 6b8efa8e9baaa5946306e2fdc53beb8a2ebf585b Mon Sep 17 00:00:00 2001 From: uz Date: Fri, 26 Aug 2011 13:01:29 +0000 Subject: [PATCH] Add a (currently empty) type string to the debug info for symbols and functions. git-svn-id: svn://svn.cc65.org/cc65/trunk@5274 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/dbginfo.c | 40 +++++++++++++++++++++++++++++++++------- src/cc65/function.c | 8 ++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/ca65/dbginfo.c b/src/ca65/dbginfo.c index dfa513053..7c098aa33 100644 --- a/src/ca65/dbginfo.c +++ b/src/ca65/dbginfo.c @@ -112,9 +112,10 @@ void DbgInfoFunc (void) "STATIC", }; - StrBuf Name = STATIC_STRBUF_INITIALIZER; - StrBuf AsmName = STATIC_STRBUF_INITIALIZER; - int StorageClass; + StrBuf Name = STATIC_STRBUF_INITIALIZER; + StrBuf Type = STATIC_STRBUF_INITIALIZER; + StrBuf AsmName = STATIC_STRBUF_INITIALIZER; + int StorageClass; /* Parameters are separated by a comma */ @@ -131,6 +132,17 @@ void DbgInfoFunc (void) /* Comma expected */ ConsumeComma (); + /* Type */ + if (CurTok.Tok != TOK_STRCON) { + ErrorSkip ("String constant expected"); + return; + } + SB_Copy (&Type, &CurTok.SVal); + NextTok (); + + /* Comma expected */ + ConsumeComma (); + /* The storage class follows */ if (CurTok.Tok != TOK_IDENT) { ErrorSkip ("Storage class specifier expected"); @@ -156,6 +168,7 @@ void DbgInfoFunc (void) /* Free memory used for the strings */ SB_Done (&AsmName); + SB_Done (&Type); SB_Done (&Name); } @@ -222,10 +235,11 @@ void DbgInfoSym (void) "STATIC", }; - StrBuf Name = STATIC_STRBUF_INITIALIZER; - StrBuf AsmName = STATIC_STRBUF_INITIALIZER; - int StorageClass; - int Offs; + StrBuf Name = STATIC_STRBUF_INITIALIZER; + StrBuf Type = STATIC_STRBUF_INITIALIZER; + StrBuf AsmName = STATIC_STRBUF_INITIALIZER; + int StorageClass; + int Offs; /* Parameters are separated by a comma */ @@ -242,6 +256,17 @@ void DbgInfoSym (void) /* Comma expected */ ConsumeComma (); + /* Type */ + if (CurTok.Tok != TOK_STRCON) { + ErrorSkip ("String constant expected"); + return; + } + SB_Copy (&Type, &CurTok.SVal); + NextTok (); + + /* Comma expected */ + ConsumeComma (); + /* The storage class follows */ if (CurTok.Tok != TOK_IDENT) { ErrorSkip ("Storage class specifier expected"); @@ -276,6 +301,7 @@ void DbgInfoSym (void) /* Free memory used for the strings */ SB_Done (&AsmName); + SB_Done (&Type); SB_Done (&Name); } diff --git a/src/cc65/function.c b/src/cc65/function.c index b31bfd796..18f6c42fb 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -368,7 +368,7 @@ static void EmitDebugInfo (void) const SymTable* Tab = Desc->SymTab; /* Output info for the function itself */ - AddTextLine ("\t.dbg\tfunc, \"%s\", %s, \"%s\"", + AddTextLine ("\t.dbg\tfunc, \"%s\", \"\", %s, \"%s\"", Sym->Name, (Sym->Flags & SC_EXTERN)? "extern" : "static", Sym->AsmName); @@ -378,14 +378,14 @@ static void EmitDebugInfo (void) while (Sym) { if ((Sym->Flags & (SC_CONST|SC_TYPE)) == 0) { if (Sym->Flags & SC_AUTO) { - AddTextLine ("\t.dbg\tsym, \"%s\", auto, %d", + AddTextLine ("\t.dbg\tsym, \"%s\", \"\", auto, %d", Sym->Name, Sym->V.Offs); } else if (Sym->Flags & SC_REGISTER) { - AddTextLine ("\t.dbg\tsym, \"%s\", register, %d", + AddTextLine ("\t.dbg\tsym, \"%s\", \"\", register, %d", Sym->Name, Sym->V.R.RegOffs); } else { - AddTextLine ("\t.dbg\tsym, \"%s\", %s, \"%s\"", + AddTextLine ("\t.dbg\tsym, \"%s\", \"\", %s, \"%s\"", Sym->Name, (Sym->Flags & SC_EXTERN)? "extern" : "static", Sym->AsmName); -- 2.39.5