mirror of
https://github.com/cc65/cc65.git
synced 2025-01-26 17:36:57 +00:00
Some code cleanup.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5282 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
eee6068029
commit
c2bf1b9ba4
@ -213,7 +213,7 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O, unsigned Id)
|
||||
|
||||
|
||||
|
||||
void ClearDbgSymTable (void)
|
||||
static void ClearDbgSymTable (void)
|
||||
/* Clear the debug symbol table */
|
||||
{
|
||||
unsigned I;
|
||||
@ -349,39 +349,49 @@ void PrintDbgSyms (FILE* F)
|
||||
|
||||
|
||||
|
||||
void PrintDbgSymLabels (ObjData* O, FILE* F)
|
||||
void PrintDbgSymLabels (FILE* F)
|
||||
/* Print the debug symbols in a VICE label file */
|
||||
{
|
||||
unsigned I;
|
||||
unsigned I, J;
|
||||
|
||||
/* Walk through all debug symbols in this module */
|
||||
for (I = 0; I < CollCount (&O->DbgSyms); ++I) {
|
||||
/* Clear the symbol table */
|
||||
ClearDbgSymTable ();
|
||||
|
||||
long Val;
|
||||
/* Create labels from all modules we have linked into the output file */
|
||||
for (I = 0; I < CollCount (&ObjDataList); ++I) {
|
||||
|
||||
/* Get the next debug symbol */
|
||||
DbgSym* D = CollAt (&O->DbgSyms, I);
|
||||
/* Get the object file */
|
||||
ObjData* O = CollAtUnchecked (&ObjDataList, I);
|
||||
|
||||
/* Emit this symbol only if it is a label (ignore equates and imports) */
|
||||
if (SYM_IS_EQUATE (D->Type) || SYM_IS_IMPORT (D->Type)) {
|
||||
continue;
|
||||
/* Walk through all debug symbols in this module */
|
||||
for (J = 0; J < CollCount (&O->DbgSyms); ++J) {
|
||||
|
||||
long Val;
|
||||
|
||||
/* Get the next debug symbol */
|
||||
DbgSym* D = CollAt (&O->DbgSyms, J);
|
||||
|
||||
/* Emit this symbol only if it is a label (ignore equates and imports) */
|
||||
if (SYM_IS_EQUATE (D->Type) || SYM_IS_IMPORT (D->Type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get the symbol value */
|
||||
Val = GetDbgSymVal (D);
|
||||
|
||||
/* Lookup this symbol in the table. If it is found in the table, it was
|
||||
* already written to the file, so don't emit it twice. If it is not in
|
||||
* the table, insert and output it.
|
||||
*/
|
||||
if (GetDbgSym (D, Val) == 0) {
|
||||
|
||||
/* Emit the VICE label line */
|
||||
fprintf (F, "al %06lX .%s\n", Val, GetString (D->Name));
|
||||
|
||||
/* Insert the symbol into the table */
|
||||
InsertDbgSym (D, Val);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the symbol value */
|
||||
Val = GetDbgSymVal (D);
|
||||
|
||||
/* Lookup this symbol in the table. If it is found in the table, it was
|
||||
* already written to the file, so don't emit it twice. If it is not in
|
||||
* the table, insert and output it.
|
||||
*/
|
||||
if (GetDbgSym (D, Val) == 0) {
|
||||
|
||||
/* Emit the VICE label line */
|
||||
fprintf (F, "al %06lX .%s\n", Val, GetString (D->Name));
|
||||
|
||||
/* Insert the symbol into the table */
|
||||
InsertDbgSym (D, Val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,15 +72,10 @@ typedef struct DbgSym DbgSym;
|
||||
DbgSym* ReadDbgSym (FILE* F, ObjData* Obj, unsigned Id);
|
||||
/* Read a debug symbol from a file, insert and return it */
|
||||
|
||||
void ClearDbgSymTable (void);
|
||||
/* Clear the debug symbol table. Must be called before outputting debug syms
|
||||
* or debug labels the first time.
|
||||
*/
|
||||
|
||||
void PrintDbgSyms (FILE* F);
|
||||
/* Print the debug symbols in a debug file */
|
||||
|
||||
void PrintDbgSymLabels (ObjData* O, FILE* F);
|
||||
void PrintDbgSymLabels (FILE* F);
|
||||
/* Print the debug symbols in a VICE label file */
|
||||
|
||||
|
||||
|
@ -132,29 +132,17 @@ void CreateMapFile (int ShortMap)
|
||||
void CreateLabelFile (void)
|
||||
/* Create a label file */
|
||||
{
|
||||
unsigned I;
|
||||
|
||||
/* Open the label file */
|
||||
FILE* F = fopen (LabelFileName, "w");
|
||||
if (F == 0) {
|
||||
Error ("Cannot create label file `%s': %s", LabelFileName, strerror (errno));
|
||||
}
|
||||
|
||||
/* Clear the debug sym table (used to detect duplicates) */
|
||||
ClearDbgSymTable ();
|
||||
|
||||
/* Print the labels for the export symbols */
|
||||
PrintExportLabels (F);
|
||||
|
||||
/* Create labels from all modules we have linked into the output file */
|
||||
for (I = 0; I < CollCount (&ObjDataList); ++I) {
|
||||
|
||||
/* Get the object file */
|
||||
ObjData* O = CollAtUnchecked (&ObjDataList, I);
|
||||
|
||||
/* Output the labels */
|
||||
PrintDbgSymLabels (O, F);
|
||||
}
|
||||
/* Output the labels */
|
||||
PrintDbgSymLabels (F);
|
||||
|
||||
/* Close the file */
|
||||
if (fclose (F) != 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user