]> git.sur5r.net Git - cc65/commitdiff
Handle scopes with a label correctly. Add the label to the debug info file.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 7 Aug 2011 18:48:08 +0000 (18:48 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 7 Aug 2011 18:48:08 +0000 (18:48 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5133 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/ld65/scopes.c
src/ld65/scopes.h

index a6832f46a73c92c0639097242618f346fdefb33b..c315ec9cdb17111921295b2073b3c019e67fae87 100644 (file)
@@ -61,6 +61,7 @@ static Scope* NewScope (ObjData* Obj, unsigned Id)
     S->Id       = Id;
     S->Obj      = Obj;
     S->Size     = 0;
+    S->LabelId  = ~0U;
     S->Spans    = EmptyCollection;
 
     /* Return the new entry */
@@ -84,6 +85,9 @@ Scope* ReadScope (FILE* F, ObjData* Obj, unsigned Id)
     if (SCOPE_HAS_SIZE (S->Flags)) {
         S->Size     = ReadVar (F);
     }
+    if (SCOPE_HAS_LABEL (S->Flags)) {
+        S->LabelId  = ReadVar (F);
+    }
 
     /* Read the segment ranges for this scope */
     ReadSpans (&S->Spans, F, Obj);
@@ -124,7 +128,11 @@ void PrintDbgScopes (FILE* F)
             if (S->Id != S->ParentId) {
                 fprintf (F, ",parent=%u", O->ScopeBaseId + S->ParentId);
             }
-
+            /* Print the label id if the scope is labeled */
+            if (SCOPE_HAS_LABEL (S->Flags)) {
+                fprintf (F, ",sym=%u", O->SymBaseId + S->LabelId);
+            }
+       
             /* Terminate the output line */
             fputc ('\n', F);
         }
index 1af33fa4c2d3de9cbc492412ce88d112f8238d07..6c772e43054a6ddf5eb4aeca06769e9a806dcf40 100644 (file)
 typedef struct Scope Scope;
 struct Scope {
     unsigned            Id;             /* Id of scope */
-    ObjData*                   Obj;            /* Object file that exports the name */
+    ObjData*                   Obj;            /* Object file that contains the scope */
     unsigned            ParentId;       /* Id of parent scope */
-    unsigned            LexicalLevel;   /* Lexical level */
+    unsigned            LabelId;        /* Id of the scope label if any */
+    unsigned            LexicalLevel;   /* Lexical level */               
     unsigned            Flags;
     unsigned            Type;           /* Type of scope */
     unsigned            Name;           /* Name of scope */