PR28149, debug info with wrong file association
Alan Modra
amodra@gmail.com
Fri Sep 17 08:32:04 GMT 2021
On Fri, Sep 17, 2021 at 09:25:33AM +0200, Eric Botcazou wrote:
> > gcc-11 and gcc-12 pass -gdwarf-5 to gas, in order to prime gas for
> > DWARF 5 level debug info. Unfortunately it seems there are cases
> > where the compiler does not emit a .file or .loc dwarf debug directive
> > before any machine instructions. (Note that the .file directive
> > typically emitted as the first line of assembly output doesn't count as
> > a dwarf debug directive. The dwarf .file has a file number before the
> > file name string.)
>
> That"s no longer true in DWARF 5, as there is always a .file 0 directive now.
I did check before making that statement. :-)
A freshly built x86_64-linux mainline gcc compiling this testcase
asm("nop");
int main ()
{
return 0;
}
~/build/gcc/gcc/xgcc -B ~/build/gcc/gcc/ -g pr28149.c -v -save-temps
shows the assembler being invoked with --gdwarf-5 on the following
.file "pr28149.c"
.text
.Ltext0:
#APP
nop
#NO_APP
.globl main
.type main, @function
main:
.LFB0:
.file 1 "pr28149.c"
.loc 1 3 1
.cfi_startproc
[snip rest]
So we have an instruction being emitted before gas generated line info
is turned off at ".file 1 ...".
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list