[PATCH] Emit .file 0 marker earlier in DWARF 5

Eric Botcazou botcazou@adacore.com
Wed Jun 23 10:06:27 GMT 2021


when the assembler supports it, the compiler automatically passes --gdwarf-5
to it, which has an interesting side effect: any assembly instruction prior
to the first .file directive defines a new line associated with .file 0 in
the .debug_line section and, of course, the numbering of these implicit lines
has nothing to do with that of the source code.  This can be problematic in
Ada where we do not generate .file/.loc directives for some compiled-generated
functions to avoid too jumpy a debugging experience.

The attached patch moves the .file 0 marker from the .debug_line section to the
beginning of the file (next to the .cfi_sections marker).

Tested on x86-64/Linux and x86[-64]/Windows, OK for mainline and 11 branch?

2021-06-23  Eric Botcazou  <ebotcazou@adacore.com>

	* dwarf2out.c (dwarf2out_assembly_start): Emit .file 0 marker here...
	(dwarf2out_finish): ...instead of here.

Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 2194 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210623/74d28cc8/attachment-0001.bin>

More information about the Gcc-patches mailing list