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

Jeff Law jeffreyalaw@gmail.com
Wed Jun 23 14:39:04 GMT 2021

On 6/23/2021 4:06 AM, Eric Botcazou wrote:
> Hi,
> 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.
OK for the trunk now and 11 backport (your call on backporting now or 
after soak time).


More information about the Gcc-patches mailing list