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/30829] [gdb/symtab] Review write_gdbindex for dwz
Date: Fri, 08 Sep 2023 12:59:52 +0000	[thread overview]
Message-ID: <bug-30829-4717-lu2y2AJNcM@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30829-4717@http.sourceware.org/bugzilla/>

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> We do this:
> ...
>       const auto insertpair = cu_index_htab.emplace (per_cu, counter);
> ...
> which looks incorrect for per_cu->is_dwz.

This is actually used.

Consider test-case gdb.dwarf2/dwzbuildid.exp.

When running the test-case using target board cc-with-gdb-index, it passes
(well for the one executable that it manages to build), but gdb quietly ignores
the .gdb_index section, because the .gnu_debugaltlink file doesn't have a
.gdb_index section.

The target board uses gdb-add-index, which currently doesn't support this.

So I wrote a new target board cc-with-index-cache, because the index-cache
already does support this.

To my surprise, the test-case still passes.

There seems to be some undocumented behaviour going on (at least, I don't see
any explicit mention of the following here:
https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html#Index-Section-Format
).

Indeed each .gdb_index section has a CU/TU table, and the section for the
.gnu_debugaltlink file contains nothing else.

I think the assumption was that a .gnu_debugaltlink contains only PUs, and that
the toplevel symbol table only contains references to CUs/TUs, which will be
pointing to the toplevel CU/TU table.

However, in this test-case the .gnu_debugaltlink file contains a CU.

And the reference in the toplevel symbol table point towards it, in the sense
that the virtual toplevel CU/TU table (otherwise known as all_units) first
contains the toplevel CU/PUs, then toplevel TUs, then .gnu_debugaltlink CU/PUs,
then .gnu_debugaltlink TUs.

Readelf doesn't understand this, and consequently shows:
...
[512] the_int: T1 [static, variable]
...
But there are no type units, and this could be printed as 'L1', meaning the
first item in the CU list of the .gdb_index section in the .gnu_debugaltlink
file.

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

  parent reply	other threads:[~2023-09-08 12:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07 13:15 [Bug symtab/30829] New: " vries at gcc dot gnu.org
2023-09-07 17:50 ` [Bug symtab/30829] " tromey at sourceware dot org
2023-09-08  5:54 ` vries at gcc dot gnu.org
2023-09-08 12:59 ` vries at gcc dot gnu.org [this message]
2023-09-08 13:14 ` vries at gcc dot gnu.org
2023-09-08 13:24 ` vries at gcc dot gnu.org
2023-09-12  8:46 ` vries at gcc dot gnu.org
2023-09-12 10:01 ` vries at gcc dot gnu.org
2023-09-12 10:05 ` vries 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-30829-4717-lu2y2AJNcM@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).