unsigned LabelCount = GetCodeLabelCount (E);
while (LabelCount--) {
CodeLabel* L = GetCodeLabel (E, LabelCount);
- L->Flags &= ~LF_DEF;
L->Owner = 0;
CollAppend (&S->Labels, L);
}
break;
default:
- E = ParseInsn (S, LI, L);
+ E = ParseInsn (S, LI, L);
break;
}
/* Get the next entry */
const CodeEntry* E = CollConstAt (&S->Entries, I);
/* Check if the line info has changed. If so, output the source line
- * if the option is enabled.
+ * if the option is enabled and output debug line info if the debug
+ * option is enabled.
*/
if (E->LI != LI) {
+ /* Line info has changed, remember the new line info */
LI = E->LI;
+
+ /* Add the source line as a comment */
if (AddSource) {
- /* Skip spaces to make the output somewhat more readable */
- const char* Line = LI->Line;
- while (IsBlank (*Line)) {
- ++Line;
- }
- fprintf (F, ";\n; %s\n;\n", Line);
+ fprintf (F, ";\n; %s\n;\n", LI->Line);
+ }
+
+ /* Add line debug info */
+ if (DebugInfo) {
+ fprintf (F, "\t.dbg\tline, \"%s\", %u\n",
+ GetInputName (LI), GetInputLine (LI));
}
}
/* Output the code */
OutputCodeEntry (E, F);
}
+ /* If debug info is enabled, terminate the last line number information */
+ if (DebugInfo) {
+ fprintf (F, "\t.dbg\tline\n");
+ }
+
/* If this is a segment for a function, leave the function */
if (S->Func) {
fprintf (F, "\n.endproc\n\n");