public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/16253] Cannot print an enum var with the same name as tag
Date: Wed, 28 May 2014 01:51:00 -0000	[thread overview]
Message-ID: <bug-16253-4717-V5KSCPYOOv@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16253-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=16253

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |dje at google dot com
         Resolution|FIXED                       |---

--- Comment #7 from dje at google dot com ---
Alas the patch introduces a massive perf regression in one of my perf tests.

Using my standard monster testcase, doing "info fun ^foo::(anonymous
namespace)" goes from about a minute to an untold number of minutes (expected
to be in the thousands :-)).

.gdb_index has this for int64:

[1476052] int64:
        2 [static, type]
        4 [static, type]
        5 [static, type]
        ...

There are 10K such entries.

The output of "info fun ..." includes "int64" so cp_canonicalize_string_full
("int64") is called.

cp-support.c:inspect_type first tries to look up the symbol in STRUCT_DOMAIN,
and then in VAR_DOMAIN.  The problem is that there is insufficient info in the
index to know a lookup in STRUCT_DOMAIN will fail, so dw2_symtab_iter_next will
blindly return every entry in the index, which will cause every CU to be
expanded.  Later, when we do the lookup in the symtab, the domains won't match
(int64 is in VAR_DOMAIN) so the lookup will fail and we'll try the next entry
in the index ...

Later, inspect_type will try VAR_DOMAIN:

    if (current_language->la_language == language_cplus)
      sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0);
    if (sym == NULL)
      sym = lookup_symbol (name, 0, VAR_DOMAIN, NULL);

but that's only after gdb has expanded the debug info for 10K CUs.
Ugh.

One solution is to encode the STRUCT_DOMAIN/VAR_DOMAIN attribute in the index.
We should first see what's involved in generating this, and whether gold can.

Another solution would be for symbol lookup to stop iterating over every CU
looking for static symbols (or at least not do that until the very VERY end).
If I'm in CU foo.o I should expect to not get the definition of "static" symbol
baz in bar.o.  This also ties in with the currently broken lookup of "int": we
should search the current CU, then the arch defaults, then maybe as a last
resort every CU.  The performance cost of these "last resort" lookups on big
programs has soured me on doing that by default though.

In the case of "info fun ..." where cp_canonicalize_string_full isn't passed a
CU (so how can it know which CU to look in for static symbols), we need to
start passing it one (and similarly throughout gdb).

I'm going to check if there's an existing PR for this perf problem, and open a
new one if not.

I think this is a blocker for 7.8.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2014-05-28  1:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 14:24 [Bug gdb/16253] New: " polacek at redhat dot com
2013-11-26 14:27 ` [Bug gdb/16253] " polacek at redhat dot com
2013-11-27 18:52 ` keiths at redhat dot com
2013-11-27 23:48 ` polacek at redhat dot com
2014-03-21 18:14 ` [Bug c++/16253] " keiths at redhat dot com
2014-04-14 22:56 ` cvs-commit at gcc dot gnu.org
2014-04-14 22:57 ` keiths at redhat dot com
2014-05-28  1:51 ` dje at google dot com [this message]
2014-05-28  1:54 ` dje at google dot com
2014-05-28 17:25 ` dje at google dot com
2014-06-04  3:32 ` xdje42 at gmail dot com
2014-08-29 13:37 ` lgustavo at codesourcery dot com
2015-06-03 15:36 ` fche at redhat dot com
2015-06-03 16:06 ` jason at redhat dot com
2015-06-03 16:09 ` jason at redhat dot com
2015-06-03 16:10 ` jason at redhat dot com
2015-06-03 16:15 ` dje at google dot com
2015-06-03 16:19 ` mgretton at sourceware dot org
2015-06-03 17:32 ` dje at google dot com
2015-06-04 16:01 ` fweimer at redhat dot com
2015-06-04 17:29 ` dje at google dot com
2015-06-12 15:53 ` keiths at redhat dot com
2015-06-26 18:43 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-16253-4717-V5KSCPYOOv@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).