Bug 15646 - gold-generated .gdb_index has duplicated symbols that gdb-generated index doesn't
Summary: gold-generated .gdb_index has duplicated symbols that gdb-generated index doe...
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-18 22:32 UTC by dje
Modified: 2018-05-02 08:29 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dje 2013-06-18 22:32:44 UTC
The gdb-generated .gdb_index doesn't have duplicate entries in the symbol table for classes and namespaces (gdb's .gdb_index is based on its partial symbols, and gdb only keeps one copy of global partial syms).

The gold-generated .gdb_index does have duplicate entries for classes and namespaces.  This causes performance issues in gdb.
e.g. "break foo::misspelled" will expand the debug info for every CU recorded for "foo" in .gdb_index.

Example:

foo.h:
namespace N1
{
  class C1
  {
   public:
    static void baz () {}
  };
}

foo-1.cc:
#include "foo.h"

namespace N1
{
  void foo () { C1::baz (); }
}

int
main ()
{
  return 0;
}

foo-2.cc:
#include "namespace-n.h"

namespace N1
{
  void bar () { C1::baz (); }
}

The gold generated index has:

[721] N1::C1::baz:
        2 [global function]
        3 [global function]
[759] N1:
        2 [global type]
        3 [global type]
[961] N1::C1:
        2 [global type]
        3 [global type]

The gdb generated index has:

[721] N1::C1::baz: 2 [global function]
[759] N1: T0 [global type]
[961] N1::C1: T0 [global type]
Comment 1 dje 2013-11-12 18:03:14 UTC
Checked in this workaround in gdb:

https://sourceware.org/ml/src-cvs/2013-q4/msg00119.html
Comment 2 Martin Richtarsky 2018-04-09 14:04:05 UTC
I found this bug while debugging another issue I had with gdb, described here:
https://sourceware.org/bugzilla/show_bug.cgi?id=23042

Any idea why my problem is not resolved by the workaround pushed here? Could the workaround be extended to also handle the other case?

Also, it would be great if the gold index could be made more compatible, which is the scope of this bug I guess.

Best regards,
Martin
Comment 3 Martin Richtarsky 2018-05-02 08:29:03 UTC
Retested with binutils-2.29, same issue.