public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/31295] Slow symbol lookup due to missing DW_AT_const_value attribute
Date: Fri, 26 Jan 2024 15:43:25 +0000	[thread overview]
Message-ID: <bug-31295-4717-alHCspHe2I@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31295-4717@http.sourceware.org/bugzilla/>

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Dmitry Neverov from comment #5)
> Created attachment 15335 [details]
> repro without grepping symtabs
> 
> Maybe I'm misinterpreting results, but I think I can reproduce it if I drop
> grep in your script: util.cpp appears after 'print str'.

Thanks for posting your logs, that helped me figure it out.

FWIW, AFAIU the grep was not the problem (but dropping the grep gave me the
info I needed).

Your three logs all use gcc 12, as far as I can tell from the producer strings.

Since gcc-11, dwarf-5 is the default.  But the gcc-12 package I'm using
defaults to dwarf-4.

So, after hardcoding -gdwarf-5, I was able to reproduce it (with trunk btw).

I've looked at the difference, and with dwarf4 for main we have:
...
 <1><2445>: Abbrev Number: 10 (DW_TAG_class_type)
    <2446>   DW_AT_name        : wxString
    <244a>   DW_AT_byte_size   : 16
 <2><2452>: Abbrev Number: 80 (DW_TAG_member)
    <2453>   DW_AT_name        : npos
    <245a>   DW_AT_type        : <0xd2d>
    <245e>   DW_AT_external    : 1
    <245e>   DW_AT_accessibility: 1     (public)
    <245f>   DW_AT_declaration : 1
...
and with dwarf5:
...
 <1><2a96>: Abbrev Number: 27 (DW_TAG_class_type)
    <2a97>   DW_AT_name        : wxString
    <2a9b>   DW_AT_byte_size   : 16
 <2><2aa3>: Abbrev Number: 28 (DW_TAG_variable)
    <2aa4>   DW_AT_name        : npos
    <2aab>   DW_AT_linkage_name: _ZN8wxString4nposE
    <2aaf>   DW_AT_type        : <0x2510>
    <2ab3>   DW_AT_external    : 1
    <2ab3>   DW_AT_accessibility: 1     (public)
    <2ab4>   DW_AT_declaration : 1
...

There are two difference: DW_TAG_member vs DW_TAG_variable, and the
presence/absence of DW_AT_linkage_name.

So, with dwarf4, we have no npos entries in the cooked index:
...
$ gdb -q -batch main -ex "maint print objfiles" | grep npos
$
...
and with dwarf5, we do:
...
$ gdb -q -batch main -ex "maint print objfiles" | grep npos
    name:       _ZN8wxString4nposE
    canonical:  _ZN8wxString4nposE
    qualified:  _ZN8wxString4nposE
    name:       npos
    canonical:  npos
    qualified:  wxString::npos
    name:       _ZN8wxString4nposE
    canonical:  _ZN8wxString4nposE
    qualified:  _ZN8wxString4nposE
    name:       npos
    canonical:  npos
    qualified:  wxString::npos
$
...

FWIW, in both cases we have the linkage symbol in main, dwarf4:
...
$ nm main | grep npos
0000000000401da0 D _ZN8wxString4nposE
...
and dwarf5:
...
$ nm main | grep npos
0000000000401da0 D _ZN8wxString4nposE
...
though it's a dynamic one.

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

  parent reply	other threads:[~2024-01-26 15:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 16:24 [Bug symtab/31295] New: " dmitry.neverov at jetbrains dot com
2024-01-25 18:58 ` [Bug symtab/31295] " dmitry.neverov at jetbrains dot com
2024-01-26  3:26 ` tromey at sourceware dot org
2024-01-26  5:22 ` vries at gcc dot gnu.org
2024-01-26  9:31 ` dmitry.neverov at jetbrains dot com
2024-01-26 11:41 ` ssbssa at sourceware dot org
2024-01-26 12:28 ` vries at gcc dot gnu.org
2024-01-26 13:28 ` dmitry.neverov at jetbrains dot com
2024-01-26 15:43 ` vries at gcc dot gnu.org [this message]
2024-01-27 11:09 ` sam at gentoo dot org
2024-01-28 20:23 ` tromey at sourceware dot org
2024-01-29  1:10 ` tromey at sourceware dot org
2024-02-11 17:52 ` tromey at sourceware dot org
2024-02-11 20:37 ` tromey at sourceware dot org
2024-02-11 21:15 ` tromey at sourceware dot org
2024-02-12 15:44 ` vries at gcc dot gnu.org
2024-02-12 20:28 ` tromey at sourceware dot org
2024-02-16  2:32 ` tromey at sourceware dot 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-31295-4717-alHCspHe2I@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).