Bug 1401091 - gdb's performance is so terrible that it is unusable
Summary: gdb's performance is so terrible that it is unusable
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-02 19:20 UTC by Nicholas Miell
Modified: 2017-12-12 10:57 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-12 10:57:39 UTC
Type: Bug
Embargoed:


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

Description Nicholas Miell 2016-12-02 19:20:37 UTC
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 14:27:30 UTC
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 14:35:41 UTC
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 15:20:34 UTC
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 15:22:20 UTC
And does it have the .gdb_index section?  As described in that Bug 1410907.

Comment 5 Pedro Alves 2017-03-31 15:30:39 UTC
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 15:38:14 UTC
(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 15:40:37 UTC
(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 15:53:44 UTC
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.

Comment 9 Fedora End Of Life 2017-11-16 18:43:46 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 10 Fedora End Of Life 2017-12-12 10:57:39 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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