]> git.sur5r.net Git - cc65/blobdiff - src/ld65/dbgsyms.c
Corrected indentation - no code change.
[cc65] / src / ld65 / dbgsyms.c
index 3cccc89f3dc565093c7f7a6aa52bd804cf2e6033..f52e082d75d99283e9a396c6f59f07c984bdda89 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2003 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 1998-2010, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -36,6 +36,7 @@
 #include <string.h>
 
 /* common */
+#include "addrsize.h"
 #include "check.h"
 #include "symdefs.h"
 #include "xmalloc.h"
@@ -81,7 +82,7 @@ static DbgSym* NewDbgSym (unsigned char Type, unsigned char AddrSize, ObjData* O
     D->Flags   = 0;
     D->Obj      = O;
     D->Expr            = 0;
-    D->Name    = 0;
+    D->Name    = 0;
     D->Type            = Type;
     D->AddrSize = AddrSize;
 
@@ -98,9 +99,9 @@ static DbgSym* GetDbgSym (DbgSym* D, long Val)
 {
     /* Create the hash. We hash over the symbol value */
     unsigned Hash = ((Val >> 24) & 0xFF) ^
-                   ((Val >> 16) & 0xFF) ^
-                   ((Val >>  8) & 0xFF) ^
-                   ((Val >>  0) & 0xFF);
+                   ((Val >> 16) & 0xFF) ^
+                   ((Val >>  8) & 0xFF) ^
+                   ((Val >>  0) & 0xFF);
 
     /* Check for this symbol */
     DbgSym* Sym = DbgSymPool[Hash];
@@ -166,7 +167,7 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O)
 
 
 
-static void ClearDbgSymTable (void)
+void ClearDbgSymTable (void)
 /* Clear the debug symbol table */
 {
     unsigned I;
@@ -183,7 +184,7 @@ static void ClearDbgSymTable (void)
 
 
 
-long GetDbgSymVal (DbgSym* D)
+long GetDbgSymVal (const DbgSym* D)
 /* Get the value of this symbol */
 {
     CHECK (D->Expr != 0);
@@ -197,16 +198,13 @@ void PrintDbgSyms (ObjData* O, FILE* F)
 {
     unsigned I;
 
-    /* Clear the debug sym table */
-    ClearDbgSymTable ();
-
     /* Walk through all debug symbols in this module */
-    for (I = 0; I < O->DbgSymCount; ++I) {
+    for (I = 0; I < CollCount (&O->DbgSyms); ++I) {
 
        long Val;
 
        /* Get the next debug symbol */
-       DbgSym* D = O->DbgSyms [I];
+       DbgSym* D = CollAt (&O->DbgSyms, I);
 
        /* Get the symbol value */
        Val = GetDbgSymVal (D);
@@ -219,9 +217,10 @@ void PrintDbgSyms (ObjData* O, FILE* F)
 
            /* Emit the debug file line */
                    fprintf (F,
-                     "sym\t\"%s\", %08lX, %s\n",
+                     "sym\t\"%s\",value=0x%08lX,addrsize=%s,type=%s\n",
                      GetString (D->Name),
                      Val,
+                     AddrSizeToStr (D->AddrSize),
                      IS_EXP_LABEL (D->Type)? "label" : "equate");
 
            /* Insert the symbol into the table */
@@ -237,16 +236,13 @@ void PrintDbgSymLabels (ObjData* O, FILE* F)
 {
     unsigned I;
 
-    /* Clear the debug sym table */
-    ClearDbgSymTable ();
-
     /* Walk through all debug symbols in this module */
-    for (I = 0; I < O->DbgSymCount; ++I) {
+    for (I = 0; I < CollCount (&O->DbgSyms); ++I) {
 
        long Val;
 
        /* Get the next debug symbol */
-       DbgSym* D = O->DbgSyms [I];
+       DbgSym* D = CollAt (&O->DbgSyms, I);
 
         /* Emit this symbol only if it is a label (ignore equates) */
         if (IS_EXP_EQUATE (D->Type)) {
@@ -273,4 +269,4 @@ void PrintDbgSymLabels (ObjData* O, FILE* F)
 
 
 
-                                     
+