public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/24820] .debug_names has incorrect contents
Date: Wed, 10 Jan 2024 20:51:54 +0000	[thread overview]
Message-ID: <bug-24820-4717-cWAeSVbeRX@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-24820-4717@http.sourceware.org/bugzilla/>

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

--- Comment #12 from Tom Tromey <tromey at sourceware dot org> ---
Thanks for your notes.

My impression is that ranges can't reliably be reconstructed
from just the top DIE, but that a full scan must be done.
I'm not really sure about this -- possibly this is only true
for older compiler or something.  But gdb supports some truly 
awful crud so maybe we're stuck.

If it does work, we could certainly implement it though.
That would solve the language problem as well... it's not
great to have to scan abbrevs and whatnot like that, but meh,
that's DWARF for you.

About the hash table:

gdb_index is basically just a hash table.  It explicitly uses
the gdb canonicalized form of symbols.  This makes it possible
to do lookups.  I think completion is done by walking all the names.  

For debug_names (after this bug is fixed), though, the scanner
creates the "cooked" internal form (same that the DWARF scanner
creates).  This lets us share data structures, lookup code, etc.
This code doesn't use a hash table at all, so adding one seemed
like extra work.  And since canonicalization isn't really solved
in the spec or in the written hash table, we'd have to do some
kind of secondary backward map (from canonical form to lookup form)
to use it.

(It's not just gcc that doesn't canonicalize names btw, there's
another bug from some other vendor in this area.)

For the linkage name flag:

I see gdb uses this in two spots.

One spot is when constructing the full name of an entry.  There's
probably some test where a linkage name is in some scope, and this
approach was expedient.  We could just register these without parents.

However, it's also used in gdb's post-scanning finalization step.
This is gross but some languages don't emit DWARF hierarchical forms.
So, for instance, for Ada gdb will synthesize the package names for
a fully-qualified symbol.

Also it isn't reliable to look for _Z for linkage names.  This works
for C++ and to some extent Rust (Rust is / will be switching mangling
schemes), but not for Go, Ada, Fortran.

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

  parent reply	other threads:[~2024-01-10 20:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-24820-4717@http.sourceware.org/bugzilla/>
2020-09-01 18:53 ` mark at klomp dot org
2021-02-18 16:27 ` tromey at sourceware dot org
2021-02-22  2:36 ` tromey at sourceware dot org
2021-02-22  8:55 ` fweimer at redhat dot com
2021-06-11 16:30 ` tromey at sourceware dot org
2022-04-22 18:03 ` tromey at sourceware dot org
2023-01-23 19:52 ` tromey at sourceware dot org
2023-12-03  0:07 ` tromey at sourceware dot org
2023-12-03  0:13 ` tromey at sourceware dot org
2023-12-03  0:16 ` tromey at sourceware dot org
2023-12-03 20:32 ` tromey at sourceware dot org
2023-12-04 14:19 ` tromey at sourceware dot org
2023-12-10 15:15 ` tromey at sourceware dot org
2023-12-10 15:16 ` tromey at sourceware dot org
2023-12-10 15:17 ` tromey at sourceware dot org
2023-12-10 15:21 ` tromey at sourceware dot org
2023-12-10 15:30 ` tromey at sourceware dot org
2024-01-10  2:01 ` tromey at sourceware dot org
2024-01-10 18:17 ` dblaikie at gmail dot com
2024-01-10 18:37 ` dblaikie at gmail dot com
2024-01-10 20:51 ` tromey at sourceware dot org [this message]
2024-01-10 20:58 ` tromey at sourceware dot org
2024-01-18 20:38 ` cvs-commit at gcc dot gnu.org
2024-01-18 20:38 ` tromey at sourceware dot org
2024-04-22 21:18 ` dblaikie at gmail dot com

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-24820-4717-cWAeSVbeRX@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).