1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

More debugging output

git-svn-id: svn://svn.cc65.org/cc65/trunk@3084 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-06-04 14:36:36 +00:00
parent eb9d9ee0c5
commit b1d7f78bce
3 changed files with 60 additions and 16 deletions

View File

@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2001-2003 Ullrich von Bassewitz */ /* (C) 2001-2004 Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Römerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -1269,6 +1269,35 @@ static char* RegInfoDesc (unsigned U, char* Buf)
static char* RegContentDesc (const RegContents* RC, char* Buf)
/* Return a string containing register contents */
{
char* B = Buf;
if (RegValIsUnknown (RC->RegA)) {
strcpy (B, "A:XX ");
} else {
sprintf (B, "A:%02X ", RC->RegA);
}
B += 5;
if (RegValIsUnknown (RC->RegX)) {
strcpy (B, "X:XX ");
} else {
sprintf (B, "X:%02X ", RC->RegX);
}
B += 5;
if (RegValIsUnknown (RC->RegY)) {
strcpy (B, "Y:XX");
} else {
sprintf (B, "Y:%02X", RC->RegY);
}
B += 4;
return Buf;
}
void CE_Output (const CodeEntry* E, FILE* F) void CE_Output (const CodeEntry* E, FILE* F)
/* Output the code entry to a file */ /* Output the code entry to a file */
{ {
@ -1357,15 +1386,24 @@ void CE_Output (const CodeEntry* E, FILE* F)
char Use [128]; char Use [128];
char Chg [128]; char Chg [128];
fprintf (F, fprintf (F,
"%*s; USE: %-12s CHG: %-12s SIZE: %u\n", "%*s; USE: %-12s CHG: %-12s SIZE: %u",
30-Chars, "", 30-Chars, "",
RegInfoDesc (E->Use, Use), RegInfoDesc (E->Use, Use),
RegInfoDesc (E->Chg, Chg), RegInfoDesc (E->Chg, Chg),
E->Size); E->Size);
} else {
/* Terminate the line */ if (E->RI) {
fprintf (F, "\n"); char RegIn[32];
char RegOut[32];
fprintf (F,
" In %s Out %s",
RegContentDesc (&E->RI->In, RegIn),
RegContentDesc (&E->RI->Out, RegOut));
}
} }
/* Terminate the line */
fprintf (F, "\n");
} }

View File

@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2001-2003 Ullrich von Bassewitz */ /* (C) 2001-2004 Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Römerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -807,7 +807,7 @@ CodeLabel* CS_GenLabel (CodeSeg* S, struct CodeEntry* E)
/* Attach this label to the code entry */ /* Attach this label to the code entry */
CE_AttachLabel (E, L); CE_AttachLabel (E, L);
} }
/* Return the label */ /* Return the label */
return L; return L;
@ -1253,7 +1253,7 @@ void CS_OutputEpilogue (const CodeSeg* S, FILE* F)
void CS_Output (const CodeSeg* S, FILE* F) void CS_Output (CodeSeg* S, FILE* F)
/* Output the code segment data to a file */ /* Output the code segment data to a file */
{ {
unsigned I; unsigned I;
@ -1267,6 +1267,9 @@ void CS_Output (const CodeSeg* S, FILE* F)
return; return;
} }
/* Generate register info */
CS_GenRegInfo (S);
/* Output the segment directive */ /* Output the segment directive */
fprintf (F, ".segment\t\"%s\"\n\n", S->SegName); fprintf (F, ".segment\t\"%s\"\n\n", S->SegName);
@ -1303,7 +1306,7 @@ void CS_Output (const CodeSeg* S, FILE* F)
/* Add line debug info */ /* Add line debug info */
if (DebugInfo) { if (DebugInfo) {
fprintf (F, "\t.dbg\tline, \"%s\", %u\n", fprintf (F, "\t.dbg\tline, \"%s\", %u\n",
GetInputName (LI), GetInputLine (LI)); GetInputName (LI), GetInputLine (LI));
} }
} }
/* Output the code */ /* Output the code */
@ -1314,6 +1317,9 @@ void CS_Output (const CodeSeg* S, FILE* F)
if (DebugInfo) { if (DebugInfo) {
fputs ("\t.dbg\tline\n", F); fputs ("\t.dbg\tline\n", F);
} }
/* Free register info */
CS_FreeRegInfo (S);
} }
@ -1463,7 +1469,7 @@ void CS_GenRegInfo (CodeSeg* S)
/* A is zero in one execution flow direction */ /* A is zero in one execution flow direction */
if (BC == BC_EQ) { if (BC == BC_EQ) {
E->RI->Out2.RegA = 0; E->RI->Out2.RegA = 0;
} else { } else {
E->RI->Out.RegA = 0; E->RI->Out.RegA = 0;
} }
break; break;
@ -1477,7 +1483,7 @@ void CS_GenRegInfo (CodeSeg* S)
E->RI->Out2.RegA = (unsigned char)P->Num; E->RI->Out2.RegA = (unsigned char)P->Num;
} else { } else {
E->RI->Out.RegA = (unsigned char)P->Num; E->RI->Out.RegA = (unsigned char)P->Num;
} }
} }
break; break;
@ -1516,7 +1522,7 @@ void CS_GenRegInfo (CodeSeg* S)
E->RI->Out2.RegX = 0; E->RI->Out2.RegX = 0;
} else { } else {
E->RI->Out.RegX = 0; E->RI->Out.RegX = 0;
} }
break; break;
case OP65_DEY: case OP65_DEY:

View File

@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2001-2003 Ullrich von Bassewitz */ /* (C) 2001-2004 Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Römerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -275,7 +275,7 @@ void CS_OutputEpilogue (const CodeSeg* S, FILE* F);
* assembler epilogue into the file. That is: Close the local function scope. * assembler epilogue into the file. That is: Close the local function scope.
*/ */
void CS_Output (const CodeSeg* S, FILE* F); void CS_Output (CodeSeg* S, FILE* F);
/* Output the code segment data to a file */ /* Output the code segment data to a file */
void CS_FreeRegInfo (CodeSeg* S); void CS_FreeRegInfo (CodeSeg* S);