From eee6068029c322f8bd752773bb9ad81faf365f49 Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 29 Aug 2011 20:02:06 +0000 Subject: [PATCH] Write the high level debug info to the object file. git-svn-id: svn://svn.cc65.org/cc65/trunk@5281 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/dbginfo.c | 40 +++++++++++++++++++++++++++++++++++++++- src/ca65/dbginfo.h | 3 +++ src/ca65/symtab.c | 6 +++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/ca65/dbginfo.c b/src/ca65/dbginfo.c index 7411e2d15..e4f50159f 100644 --- a/src/ca65/dbginfo.c +++ b/src/ca65/dbginfo.c @@ -45,7 +45,9 @@ #include "error.h" #include "expr.h" #include "filetab.h" +#include "global.h" #include "lineinfo.h" +#include "objfile.h" #include "nexttok.h" #include "symtab.h" @@ -277,7 +279,7 @@ void DbgInfoSym (void) unsigned AsmName = EMPTY_STRING_ID; unsigned Flags; int Offs; - HLDbgSym* S; + HLDbgSym* S; /* Parameters are separated by a comma */ @@ -351,3 +353,39 @@ void DbgInfoSym (void) +void WriteHLDbgSyms (void) +/* Write a list of all high level language symbols to the object file. */ +{ + unsigned I; + + /* Only if debug info is enabled */ + if (DbgSyms) { + + /* Write the symbol count to the list */ + ObjWriteVar (CollCount (&HLDbgSyms)); + + /* Walk through list and write all symbols to the file. */ + for (I = 0; I < CollCount (&HLDbgSyms); ++I) { + + /* Get the next symbol */ + const HLDbgSym* S = CollAtUnchecked (&HLDbgSyms, I); + + /* Write the symbol data */ + ObjWriteVar (S->Flags); + ObjWriteVar (S->Name); + ObjWriteVar (S->AsmName); + ObjWriteVar (S->Offs); + ObjWriteVar (S->Type); + ObjWriteVar (S->ScopeId); + } + + } else { + + /* Write a count of zero */ + ObjWriteVar (0); + + } +} + + + diff --git a/src/ca65/dbginfo.h b/src/ca65/dbginfo.h index 1334c06b2..5604067b2 100644 --- a/src/ca65/dbginfo.h +++ b/src/ca65/dbginfo.h @@ -56,6 +56,9 @@ void DbgInfoLine (void); void DbgInfoSym (void); /* Parse and handle SYM subcommand of the .dbg pseudo instruction */ +void WriteHLDbgSyms (void); +/* Write a list of all high level language symbols to the object file. */ + /* End of dbginfo.h */ diff --git a/src/ca65/symtab.c b/src/ca65/symtab.c index e0d6f8309..acb1ed3bb 100644 --- a/src/ca65/symtab.c +++ b/src/ca65/symtab.c @@ -45,9 +45,10 @@ #include "xmalloc.h" /* ca65 */ -#include "global.h" +#include "dbginfo.h" #include "error.h" #include "expr.h" +#include "global.h" #include "objfile.h" #include "scanner.h" #include "segment.h" @@ -909,6 +910,9 @@ void WriteDbgSyms (void) } + /* Write the high level symbols */ + WriteHLDbgSyms (); + /* Done writing debug symbols */ ObjEndDbgSyms (); } -- 2.39.5