Bug 1401091 - gdb's performance is so terrible that it is unusable
gdb's performance is so terrible that it is unusable
Status: NEW
Product: Fedora
Classification: Fedora
Component: gdb (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jan Kratochvil
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-12-02 14:20 EST by Nicholas Miell
Modified: 2017-04-03 13:30 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-03-31 10:35:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
relevant part of perf data recorded during a backtrace command (7.60 KB, text/plain)
2016-12-02 14:20 EST, Nicholas Miell
no flags Details

  None (edit)
Description Nicholas Miell 2016-12-02 14:20:37 EST
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):
gdb-7.12-29.fc25.x86_64

How reproducible:
Always

Steps to Reproduce:
$ pgrep firefox
3940
$ gdb
(gdb) set auto-load off 
(gdb) attach 3940
(gdb) bt
(gdb) frame 5
(gdb) info locals
etc.

Actual results:
Commands take minutes or tens of minutes to execute.

Expected results:
gdb is a usable product.
Comment 1 Thomas Sondergaard 2017-03-31 10:27:30 EDT
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()'
(gdb) r
# .. click a link in assistant and click the backward() button
(gdb) bt

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:

LD_LIBRARY_PATH=/home/ts/src/qtbase-build/lib QT_PLUGIN_PATH=/home/ts/src/qtbase-build/plugins

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?
Comment 2 Jan Kratochvil 2017-03-31 10:35:41 EDT
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 ***
Comment 3 Thomas Sondergaard 2017-03-31 11:20:34 EDT
I have rebuilt qt5-qtbase-5.7.1 with rpmbuild from rpm-build-4.13.0.1-1.fc25.x86_64 and the performance issue remains.
Comment 4 Jan Kratochvil 2017-03-31 11:22:20 EDT
And does it have the .gdb_index section?  As described in that Bug 1410907.
Comment 5 Pedro Alves 2017-03-31 11:30:39 EDT
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?
Comment 6 Thomas Sondergaard 2017-03-31 11:38:14 EDT
(In reply to Jan Kratochvil from comment #4)
> And does it have the .gdb_index section?  As described in that Bug 1410907.

Yes.

$ readelf -S /usr/lib/debug/usr/lib64/libQt5Core.so.5.7.1.debug |grep gdb_index
  [40] .gdb_index        PROGBITS         0000000000000000  01fb7c94
Comment 7 Thomas Sondergaard 2017-03-31 11:40:37 EDT
(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!
Comment 8 Pedro Alves 2017-03-31 11:53:44 EDT
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
     place.  */

  if (TYPE_IS_OPAQUE (type) 
      && opaque_type_resolution 
      && !currently_reading_symtab)
    {
      const char *name = type_name_no_tag (type);
      struct type *newtype;

      if (name == NULL)
	{
	  stub_noname_complaint ();
	  return make_qualified_type (type, instance_flags, NULL);
	}
      newtype = lookup_transparent_type (name);

      if (newtype)
	{
	  /* 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_INSTANCE_FLAGS (type),
					type);
	  else
	    type = newtype;
	}


So sounds like we're hitting the scenario described above.  It'd be interesting to know what type this is.

Note You need to log in before you can comment on or make changes to this bug.