mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 17:30:50 +00:00
Fox scopes that have a label (= .PROC), write the label to the debug
information. git-svn-id: svn://svn.cc65.org/cc65/trunk@5130 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
c19491035b
commit
af8fbf8d62
@ -807,12 +807,12 @@ static void CreateObjFile (void)
|
||||
/* Write the export list */
|
||||
WriteExports ();
|
||||
|
||||
/* Write the scopes if requested */
|
||||
WriteScopes ();
|
||||
|
||||
/* Write debug symbols if requested */
|
||||
WriteDbgSyms ();
|
||||
|
||||
/* Write the scopes if requested */
|
||||
WriteScopes ();
|
||||
|
||||
/* Write line infos if requested */
|
||||
WriteLineInfos ();
|
||||
|
||||
|
@ -817,7 +817,7 @@ static void DoEnd (void)
|
||||
static void DoEndProc (void)
|
||||
/* Leave a lexical level */
|
||||
{
|
||||
if (CurrentScope->Type != SCOPE_SCOPE || CurrentScope->OwnerSym == 0) {
|
||||
if (CurrentScope->Type != SCOPE_SCOPE || CurrentScope->Label == 0) {
|
||||
/* No local scope */
|
||||
ErrorSkip ("No open .PROC");
|
||||
} else {
|
||||
@ -830,7 +830,7 @@ static void DoEndProc (void)
|
||||
static void DoEndScope (void)
|
||||
/* Leave a lexical level */
|
||||
{
|
||||
if (CurrentScope->Type != SCOPE_SCOPE || CurrentScope->OwnerSym != 0) {
|
||||
if (CurrentScope->Type != SCOPE_SCOPE || CurrentScope->Label != 0) {
|
||||
/* No local scope */
|
||||
ErrorSkip ("No open .SCOPE");
|
||||
} else {
|
||||
|
@ -116,7 +116,7 @@ static SymTable* NewSymTable (SymTable* Parent, const StrBuf* Name)
|
||||
S->Left = 0;
|
||||
S->Right = 0;
|
||||
S->Childs = 0;
|
||||
S->OwnerSym = 0;
|
||||
S->Label = 0;
|
||||
S->Spans = AUTO_COLLECTION_INITIALIZER;
|
||||
S->Id = ScopeCount++;
|
||||
S->Flags = ST_NONE;
|
||||
@ -184,7 +184,7 @@ static SymTable* NewSymTable (SymTable* Parent, const StrBuf* Name)
|
||||
|
||||
|
||||
void SymEnterLevel (const StrBuf* ScopeName, unsigned char Type,
|
||||
unsigned char AddrSize, SymEntry* OwnerSym)
|
||||
unsigned char AddrSize, SymEntry* ScopeLabel)
|
||||
/* Enter a new lexical level */
|
||||
{
|
||||
/* Map a default address size to something real */
|
||||
@ -214,12 +214,12 @@ void SymEnterLevel (const StrBuf* ScopeName, unsigned char Type,
|
||||
CurrentScope->Flags |= ST_DEFINED;
|
||||
CurrentScope->AddrSize = AddrSize;
|
||||
CurrentScope->Type = Type;
|
||||
CurrentScope->OwnerSym = OwnerSym;
|
||||
CurrentScope->Label = ScopeLabel;
|
||||
|
||||
/* If this is a scope that allows to emit data into segments, add spans
|
||||
* for all currently existing segments. Doing this for just a few scope
|
||||
* types is not really necessary but an optimization, because it does not
|
||||
* allocate memory for useless data (unhandled types here don't occupy
|
||||
* for all currently existing segments. Doing this for just a few scope
|
||||
* types is not really necessary but an optimization, because it does not
|
||||
* allocate memory for useless data (unhandled types here don't occupy
|
||||
* space in any segment).
|
||||
*/
|
||||
if (CurrentScope->Type <= SCOPE_HAS_DATA) {
|
||||
@ -232,23 +232,23 @@ void SymEnterLevel (const StrBuf* ScopeName, unsigned char Type,
|
||||
void SymLeaveLevel (void)
|
||||
/* Leave the current lexical level */
|
||||
{
|
||||
/* Close the spans. We don't care about the scope type here, since types
|
||||
/* Close the spans. We don't care about the scope type here, since types
|
||||
* without spans will just have an empty list.
|
||||
*/
|
||||
CloseSpans (&CurrentScope->Spans);
|
||||
|
||||
/* If we have spans, the first one is the segment that was active, when the
|
||||
* scope was opened. Set the size of the scope to the number of data bytes
|
||||
* emitted into this segment. If we have an owner symbol set the size of
|
||||
/* If we have spans, the first one is the segment that was active, when the
|
||||
* scope was opened. Set the size of the scope to the number of data bytes
|
||||
* emitted into this segment. If we have an owner symbol set the size of
|
||||
* this symbol, too.
|
||||
*/
|
||||
if (CollCount (&CurrentScope->Spans) > 0) {
|
||||
const Span* S = CollAtUnchecked (&CurrentScope->Spans, 0);
|
||||
unsigned long Size = GetSpanSize (S);
|
||||
DefSizeOfScope (CurrentScope, Size);
|
||||
if (CurrentScope->OwnerSym) {
|
||||
DefSizeOfSymbol (CurrentScope->OwnerSym, Size);
|
||||
}
|
||||
if (CurrentScope->Label) {
|
||||
DefSizeOfSymbol (CurrentScope->Label, Size);
|
||||
}
|
||||
}
|
||||
|
||||
/* Leave the scope */
|
||||
@ -914,6 +914,11 @@ void WriteScopes (void)
|
||||
Flags |= SCOPE_SIZE;
|
||||
}
|
||||
|
||||
/* Check if the scope has a label */
|
||||
if (S->Label) {
|
||||
Flags |= SCOPE_LABELED;
|
||||
}
|
||||
|
||||
/* Scope must be defined */
|
||||
CHECK (S->Type != SCOPE_UNDEF);
|
||||
|
||||
@ -941,6 +946,11 @@ void WriteScopes (void)
|
||||
ObjWriteVar (Size);
|
||||
}
|
||||
|
||||
/* If the scope has a label, write its id to the file */
|
||||
if (SCOPE_HAS_LABEL (Flags)) {
|
||||
ObjWriteVar (S->Label->DebugSymId);
|
||||
}
|
||||
|
||||
/* Spans for this scope */
|
||||
WriteSpans (&S->Spans);
|
||||
|
||||
|
@ -67,7 +67,7 @@ struct SymTable {
|
||||
SymTable* Right; /* Pointer to greater entry */
|
||||
SymTable* Parent; /* Link to enclosing scope if any */
|
||||
SymTable* Childs; /* Pointer to child scopes */
|
||||
SymEntry* OwnerSym; /* Symbol that "owns" the scope */
|
||||
SymEntry* Label; /* Scope label */
|
||||
Collection Spans; /* Spans for this scope */
|
||||
unsigned Id; /* Scope id */
|
||||
unsigned short Flags; /* Symbol table flags */
|
||||
|
Loading…
x
Reference in New Issue
Block a user