Re: gdb symbol lookup very slow

Jan Kratochvil <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On Wed, 28 May 2014 09:59:02 +0200, Antonio Cavallo wrote:
> Hi,
> I'm having hard time debugging a (very large) C++ library under gdb (gdb
> 7.7.1, gcc 4.8, binutils 2.22).
> 
> The main issue is the time it takes to reach a breakpoint: gdb takes an
> insane amount of time (order of 2mins) vs vs2012 (a couple of seconds).
> 
> I've profiled gdb and the top functions called during the debugging are
> (more than 90% is spent in these):

Try to use gdb-add-index (gdb/contrib/gdb-add-index.sh or
/usr/bin/gdb-add-index on some systems) with gdb-7.7+.

That the index is present in a binary you can verify with:
$ readelf -WS /usr/lib/debug/bin/bash.debug|grep -w gdb_index
  [34] .gdb_index        PROGBITS        0000000000000000 21bc44 0252fa 00      0   0  1

Or with recent enough readelf even with:
	readelf --debug-dump=gdb_index /usr/lib/debug/bin/bash.debug
or with elfutils:
	eu-readelf --debug-dump=gdb_index /usr/lib/debug/bin/bash.debug

You should check you use .gdb_index version 8, older versions had various
issues and they can get ignored by recent GDBs.

There is also an unrelated GDB performance Bug which happens with binaries
optimized by 'dwz' but I do not think that is your described case.
	Bug 16405 - backtrace takes GBs and minutes with dwz -m
	https://sourceware.org/bugzilla/show_bug.cgi?id=16405



Jan
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.