Red Hat Bugzilla – Bug 1401091
gdb's performance is so terrible that it is unusable
Last modified: 2017-04-03 13:30:51 EDT
Created attachment 1227464 [details]
relevant part of perf data recorded during a backtrace command
Description of problem:
gdb takes multiple minutes per frame to display a backtrace, the frame command takes multiple minutes to complete, displaying data structures using info locals or info args or the print command takes multiple minutes per element in the structure.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
$ pgrep firefox
(gdb) set auto-load off
(gdb) attach 3940
(gdb) frame 5
(gdb) info locals
Commands take minutes or tens of minutes to execute.
gdb is a usable product.
I have the same experience with gdb under fedora 25 when I have debuginfo packages installed. If I'm only using the debugging information from code that I have built on my own, performance is acceptable.
An example running assistant-qt from qt5-assistant-5.7.1-4.fc25.x86_64:
$ dnf install qt5-qtbase-debuginfo
$ gdb -- assistant-qt5
(gdb) b 'CentralWidget::backward()'
# .. click a link in assistant and click the backward() button
The bt command takes 43 seconds to complete.
if I run the exact same command but link with a local developer build of qtbase, like this:
then the backtrace from 'CentralWidget::backward()' takes less than a second.
Could this be the same issue with dwz compression as was discovered and fixed once already in bug 1149865?
I think this is Bug 1410907 - during F-25 build time .gdb_index was not being generated.
*** This bug has been marked as a duplicate of bug 1410907 ***
I have rebuilt qt5-qtbase-5.7.1 with rpmbuild from rpm-build-184.108.40.206-1.fc25.x86_64 and the performance issue remains.
And does it have the .gdb_index section? As described in that Bug 1410907.
Looking at the perf trace attached, makes me suspect something odd with debug info causing GDB to redo an expensive operation over and over:
Does "set opaque-type-resolution off" make any difference?
(In reply to Jan Kratochvil from comment #4)
> And does it have the .gdb_index section? As described in that Bug 1410907.
$ readelf -S /usr/lib/debug/usr/lib64/libQt5Core.so.5.7.1.debug |grep gdb_index
 .gdb_index PROGBITS 0000000000000000 01fb7c94
(In reply to Pedro Alves from comment #5)
> Looking at the perf trace attached, makes me suspect something odd with
> debug info causing GDB to redo an expensive operation over and over:
> Does "set opaque-type-resolution off" make any difference?
Absolutely. It is very fast with that option turned off. Good find!
OK, the code in GDB that that option disables reads:
/* If this is a struct/class/union with no fields, then check
whether a full definition exists somewhere else. This is for
systems where a type definition with no fields is issued for such
types, instead of identifying them as stub types in the first
if (TYPE_IS_OPAQUE (type)
const char *name = type_name_no_tag (type);
struct type *newtype;
if (name == NULL)
return make_qualified_type (type, instance_flags, NULL);
newtype = lookup_transparent_type (name);
/* If the resolved type and the stub are in the same
objfile, then replace the stub type with the real deal.
But if they're in separate objfiles, leave the stub
alone; we'll just look up the transparent type every time
we call check_typedef. We can't create pointers between
types allocated to different objfiles, since they may
have different lifetimes. Trying to copy NEWTYPE over to
TYPE's objfile is pointless, too, since you'll have to
move over any other types NEWTYPE refers to, which could
be an unbounded amount of stuff. */
if (TYPE_OBJFILE (newtype) == TYPE_OBJFILE (type))
type = make_qualified_type (newtype,
type = newtype;
So sounds like we're hitting the scenario described above. It'd be interesting to know what type this is.