This is the mail archive of the
mailing list for the GDB project.
Re: gdb symbol lookup very slow
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Antonio Cavallo <a dot cavallo at cavallinux dot eu>
- Cc: gdb at sourceware dot org
- Date: Thu, 29 May 2014 21:22:12 +0200
- Subject: Re: gdb symbol lookup very slow
- Authentication-results: sourceware.org; auth=none
- References: <53859746 dot 7030601 at cavallinux dot eu>
On Wed, 28 May 2014 09:59:02 +0200, Antonio Cavallo wrote:
> 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
 .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