Re: GDB and debug fission

Alexander Yermolovich via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <BN7PR15MB246607BB30B89427A7C9846BBFAE0@BN7PR15MB2466.namprd15.prod.outlook.com>
Thanks for clarification.
Yep I saw LLD builds gdb_index using gnu-pubnames. It just wasn't clear to me if gdb needs it with split-dwarf. I saw a comment on one of llvm reviews from couple years ago about it, but things might have changed since then. So thought I would ask. 🙂

Without gdb_index and gnu_pubnames what will be the behavior of gdb?
I tried a toy example locally with split-dwarf without gdb_index and pubnames and it seemed to work with binary compiled with -O2 and -g2.
By work I mean I was able to step through code and print same variables as when I compiled it with monolithic debug information.

Thank You
Alex

________________________________
From: Sterling Augustine <[email protected]>
Sent: Thursday, January 7, 2021 5:48 PM
To: Alexander Yermolovich <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: GDB and debug fission

On Thu, Jan 7, 2021 at 5:25 PM Alexander Yermolovich via Gdb
<[email protected]> wrote:
>
> Hello.
>
> For latest gdb to work with -gsplit-dwarf debug information generated by clang, either in split or single mode does it need gdb_index or pubnames?
> In normal case where debug information is part of executable gdb_index is nice to speed up startup time, and I think I read pubnames is not used, but with debug fission are either gdb_index or pubnames necessary?

For gdb to work with split-dwarf debug info, it needs a gdb_index.
That can be generated in several ways. Gdb can build one itself--there
is a script somewhere to add a gdb index.

But it is somewhat easier to have the linker you use generate
gdb_index for you (both gnu-ld and llvm's lld can do this). They do
this by reading the .gnu_pubnames section, so in some way, you need
both pubnames *and* an index.

So you would ordinarily use the following commands:

$(CC) $(normal_arguments) -ggnu-pubnames
$(LD)  $(normal_arguments) -Wl,--gdb-index
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.