In any case, if you build with -g and use in addition the "debug
assembler output" flag -dA the assembler output should contain
human-readable comments containing line number information.
Regardless, if line number notes are interspersed in the stream,
maybe whenever I write out an assembler instruction I will have
access to those notes and can print out a comment.
No, that might break when you upgrade later. GCC already has support
for annotating the assembly output with human-readable line number info.
That is option -dA as Ulrich pointed out.
Only DWARF-2 output supports it currently, but if you want to use it say
together with STABS, it is just a matter of modifying dbxout_source_line
and add a single statement like this:
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s %s:%d\n", ASM_COMMENT_START,
filename, line);
Paolo