* GDB and -gdwarf-5
@ 2017-09-07 19:16 Eli Zaretskii
2017-09-07 19:24 ` Jan Kratochvil
2017-09-07 19:28 ` Joel Brobecker
0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2017-09-07 19:16 UTC (permalink / raw)
To: gdb
I have GCC 6.3.0 installed, and it seems to support DWARF2 version 5
via the -gdwarf-5 switch. But I wanted to make sure I really get that
version of debug info, so I tried "info source" in GDB. But that
command doesn't tell the version of DWARF2. Is there a GDB command
which does?
I also tried "objdump --dwarf=info" (Binutils 2.29), but that says the
DWARF2 version is 4. So now I'm confused.
Can someone please tell me how to verify the version of DWARF2 I get
with that GCC switch?
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB and -gdwarf-5
2017-09-07 19:16 GDB and -gdwarf-5 Eli Zaretskii
@ 2017-09-07 19:24 ` Jan Kratochvil
2017-09-07 20:16 ` Eli Zaretskii
2017-09-07 19:28 ` Joel Brobecker
1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2017-09-07 19:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
On Thu, 07 Sep 2017 21:16:44 +0200, Eli Zaretskii wrote:
> I have GCC 6.3.0 installed, and it seems to support DWARF2 version 5
> via the -gdwarf-5 switch. But I wanted to make sure I really get that
> version of debug info, so I tried "info source" in GDB. But that
> command doesn't tell the version of DWARF2. Is there a GDB command
> which does?
>
> I also tried "objdump --dwarf=info" (Binutils 2.29), but that says the
> DWARF2 version is 4. So now I'm confused.
Here gcc-6.3.1-1.fc25.x86_64 really accepts -gdwarf-5 but still it does produce
only DWARF 4. I do not know why.
gcc-7.1.1-3.fc26.x86_64 does produce DWARF 5.
You should really see from objdump/readelf:
Compilation Unit @ offset 0x0:
Length: 0x13c (32-bit)
Version: 5
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB and -gdwarf-5
2017-09-07 19:16 GDB and -gdwarf-5 Eli Zaretskii
2017-09-07 19:24 ` Jan Kratochvil
@ 2017-09-07 19:28 ` Joel Brobecker
2017-09-07 20:18 ` Eli Zaretskii
1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2017-09-07 19:28 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
> I have GCC 6.3.0 installed, and it seems to support DWARF2 version 5
> via the -gdwarf-5 switch. But I wanted to make sure I really get that
> version of debug info, so I tried "info source" in GDB. But that
> command doesn't tell the version of DWARF2. Is there a GDB command
> which does?
>
> I also tried "objdump --dwarf=info" (Binutils 2.29), but that says the
> DWARF2 version is 4. So now I'm confused.
>
> Can someone please tell me how to verify the version of DWARF2 I get
> with that GCC switch?
I would compile a unit, and then dump the DWARF info using objdump
or readelf. The beginning of that section includes the DWARF version
number. Alternatively, compile with -save-temps -dA, and look at
the assembly file instead. -dA annotates the directives used to
produce the DWARF, and should also make it easy to verify the version
number.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB and -gdwarf-5
2017-09-07 19:24 ` Jan Kratochvil
@ 2017-09-07 20:16 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2017-09-07 20:16 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
> Date: Thu, 7 Sep 2017 21:24:47 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb@sourceware.org
>
> > I also tried "objdump --dwarf=info" (Binutils 2.29), but that says the
> > DWARF2 version is 4. So now I'm confused.
>
> Here gcc-6.3.1-1.fc25.x86_64 really accepts -gdwarf-5 but still it does produce
> only DWARF 4. I do not know why.
OK, so I guess it's a bug or a missing feature in GCC 6.3. Thanks.
> gcc-7.1.1-3.fc26.x86_64 does produce DWARF 5.
>
> You should really see from objdump/readelf:
> Compilation Unit @ offset 0x0:
> Length: 0x13c (32-bit)
> Version: 5
Yes, I see version 4 instead. I guess I have to wait for GCC 7, then.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB and -gdwarf-5
2017-09-07 19:28 ` Joel Brobecker
@ 2017-09-07 20:18 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2017-09-07 20:18 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb
> Date: Thu, 7 Sep 2017 12:28:00 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb@sourceware.org
>
> > I also tried "objdump --dwarf=info" (Binutils 2.29), but that says the
> > DWARF2 version is 4. So now I'm confused.
> >
> > Can someone please tell me how to verify the version of DWARF2 I get
> > with that GCC switch?
>
> I would compile a unit, and then dump the DWARF info using objdump
> or readelf.
That's what I did, and objdump said it was version 4. As Jan
explained, it seems to be a deficiency in GCC 6.3.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-07 20:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07 19:16 GDB and -gdwarf-5 Eli Zaretskii
2017-09-07 19:24 ` Jan Kratochvil
2017-09-07 20:16 ` Eli Zaretskii
2017-09-07 19:28 ` Joel Brobecker
2017-09-07 20:18 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox