public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30863] New: [gdb/symtab] PU without import ignored in cooked index
@ 2023-09-17  7:13 vries at gcc dot gnu.org
  2023-09-17  7:16 ` [Bug symtab/30863] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-17  7:13 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30863
           Summary: [gdb/symtab] PU without import ignored in cooked index
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ This is with an updated version of the patch series submitted here (
https://sourceware.org/pipermail/gdb-patches/2023-August/201887.html ). ]

Consider the exec of test-case gdb.dwarf2/imported-unit-runto-main.exp, before
adding the .gdb_index section.  It has a backward inter-cu intra-shard
reference:
...
$ gdb -q -batch -iex "maint set worker-threads 0" imported-unit-runto-main
handle_deferred_entries, intra-shard case
parent map
  0x00000000000000fb 0x2935500 (deferred)
  0x00000000000000fc 0x0
parent valid map
  0x000000000000002e 0x1
  0x0000000000000045 0x0
  0x0000000000000062 0x1
  0x0000000000000084 0x0
  0x00000000000000fb 0x1
  0x0000000000000111 0x0
  0x0000000000000149 0x1
  0x00000000000002d4 0x0
handle_deferred_entries, inter-shard case
  0x00000000000000fb 0x2935500 (deferred)
  0x00000000000000fc 0x0
Resolve deferred: 0xfb -> 0xd5: no parent
...

The dependency is resolved in the inter-shard case, which assumes that all CUs
have been processed, and consequently doesn't check the parent valid map.

But if we look at the parent valid map, we don't find 0xd5.  So the "no parent"
is not a case of, we've processed 0xd5 and found that is has no parent, but
we've not processed the PU containing 0xd5.

The problem is that we have a PU without import, and consequently no CU wins
the race to read it.

This doesn't cause a problem with the current implementation (because "not
processed" and "no parent" look the same), but we can reproduce the same
problem with test-case forward-spec-inter-cu.exp. By changing one of the cus
into a pu:
...
--- a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
@@ -48,7 +48,7 @@ Dwarf::assemble $asm_file {
     }

     cu {} {
-       DW_TAG_compile_unit {
+       DW_TAG_partial_unit {
            {DW_AT_language @DW_LANG_C_plus_plus}
        } {
            declare_labels myint
...
we get:
...
FAIL: gdb.dwarf2/forward-spec-inter-cu.exp: v has a parent
...

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/30863] [gdb/symtab] PU without import ignored in cooked index
  2023-09-17  7:13 [Bug symtab/30863] New: [gdb/symtab] PU without import ignored in cooked index vries at gcc dot gnu.org
@ 2023-09-17  7:16 ` vries at gcc dot gnu.org
  2023-09-17  8:53 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-17  7:16 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Note that readnow has no problem with the dwarf, we simply get:
...
(gdb) p ns::v
$1 = 23
...
but with the cooked index:
...
(gdb) p ns::v
No symbol "ns" in current context.
...

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/30863] [gdb/symtab] PU without import ignored in cooked index
  2023-09-17  7:13 [Bug symtab/30863] New: [gdb/symtab] PU without import ignored in cooked index vries at gcc dot gnu.org
  2023-09-17  7:16 ` [Bug symtab/30863] " vries at gcc dot gnu.org
@ 2023-09-17  8:53 ` vries at gcc dot gnu.org
  2023-09-17  9:57 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-17  8:53 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> Note that readnow has no problem with the dwarf, we simply get:
> ...
> (gdb) p ns::v
> $1 = 23
> ...
> but with the cooked index:
> ...
> (gdb) p ns::v
> No symbol "ns" in current context.
> ...

Same problem with gdb-12-branch.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/30863] [gdb/symtab] PU without import ignored in cooked index
  2023-09-17  7:13 [Bug symtab/30863] New: [gdb/symtab] PU without import ignored in cooked index vries at gcc dot gnu.org
  2023-09-17  7:16 ` [Bug symtab/30863] " vries at gcc dot gnu.org
  2023-09-17  8:53 ` vries at gcc dot gnu.org
@ 2023-09-17  9:57 ` vries at gcc dot gnu.org
  2023-09-17 12:27 ` tromey at sourceware dot org
  2023-11-30 17:07 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-17  9:57 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
I have a hard time reasoning about how this dwarf should be interpreted.  

Perhaps this PR should be about unsupporting it for -readnow.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/30863] [gdb/symtab] PU without import ignored in cooked index
  2023-09-17  7:13 [Bug symtab/30863] New: [gdb/symtab] PU without import ignored in cooked index vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-17  9:57 ` vries at gcc dot gnu.org
@ 2023-09-17 12:27 ` tromey at sourceware dot org
  2023-11-30 17:07 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2023-09-17 12:27 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
I tend to think a PU that is not included just indicates a bad
DWARF writer.  Maybe gdb could issue a complaint, if it's easy.
Really a job for (the mythical) dwarflint.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/30863] [gdb/symtab] PU without import ignored in cooked index
  2023-09-17  7:13 [Bug symtab/30863] New: [gdb/symtab] PU without import ignored in cooked index vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-09-17 12:27 ` tromey at sourceware dot org
@ 2023-11-30 17:07 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2023-11-30 17:07 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
The DWARF spec says:

• A partial compilation unit describes a part of a compilation (generally
corresponding to an imported module) which is imported into one or more
related full compilation units.

So I think that a non-imported PU can safely be ignored.
The full reader could be changed to do this as well.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-30 17:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-17  7:13 [Bug symtab/30863] New: [gdb/symtab] PU without import ignored in cooked index vries at gcc dot gnu.org
2023-09-17  7:16 ` [Bug symtab/30863] " vries at gcc dot gnu.org
2023-09-17  8:53 ` vries at gcc dot gnu.org
2023-09-17  9:57 ` vries at gcc dot gnu.org
2023-09-17 12:27 ` tromey at sourceware dot org
2023-11-30 17:07 ` tromey at sourceware dot org

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).