public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case)
@ 2023-09-13 14:32 vries at gcc dot gnu.org
  2023-10-02 12:54 ` [Bug symtab/30846] " vries at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-13 14:32 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30846
           Summary: [gdb/symtab] incorrect parent for forward spec
                    (inter-cu case)
           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: ---

Created attachment 15109
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15109&action=edit
Dwarf assembly test-case demonstrating problem

Consider the attached dwarf assembly test-case, an inter-cu variant of
gdb.dwarf2/forward-spec.exp.

When we run it we get:
...
FAIL: gdb.dwarf2/forward-spec-inter-cu.exp: v has a parent
...
because:
...
    [3] ((cooked_index_entry *) 0x7f3b54005250)^M
    name:       v^M
    canonical:  v^M
    qualified:  v^M
    DWARF tag:  DW_TAG_variable^M
    flags:      0x2 [IS_STATIC]^M
    DIE offset: 0xbe^M
    parent:     ((cooked_index_entry *) 0)^M
...

The dwarf for the test-case is:
...
  Compilation Unit @ offset 0xb1:
 ...
 <0><bc>: Abbrev Number: 2 (DW_TAG_compile_unit)
    <bd>   DW_AT_language    : 4        (C++)
 <1><be>: Abbrev Number: 3 (DW_TAG_variable)
    <bf>   DW_AT_specification: <0xe2>
    <c3>   DW_AT_location    : 3 byte block: 8 17 9f    (DW_OP_const1u: 23;
DW_OP_stack_value)
  ...
  Compilation Unit @ offset 0xc8:
  ...
 <0><d3>: Abbrev Number: 2 (DW_TAG_compile_unit)
    <d4>   DW_AT_language    : 4        (C++)
  ...
 <1><de>: Abbrev Number: 4 (DW_TAG_namespace)
    <df>   DW_AT_name        : ns
 <2><e2>: Abbrev Number: 5 (DW_TAG_variable)
    <e3>   DW_AT_name        : v
    <e5>   DW_AT_type        : <0xd5>
    <e9>   DW_AT_declaration : 1
...

By looking at the compile unit offsets:
...
$ grep @ READELF
  Compilation Unit @ offset 0x0:
  Compilation Unit @ offset 0x45:
  Compilation Unit @ offset 0x84:
  Compilation Unit @ offset 0xa6:
  Compilation Unit @ offset 0xb1:
  Compilation Unit @ offset 0xc8:
  Compilation Unit @ offset 0xeb:
  Compilation Unit @ offset 0xf6:
  Compilation Unit @ offset 0x2ae:
...
we see that the 5th and 6th CUs are involved.

And then using the parallel_for_each_debug output:
...
Parallel for: n_elements: 9^M
Parallel for: total_size: 720^M
Parallel for: size_per_thread: 60^M
Parallel for: elements on worker thread 0       : 1     (size: 69)^M
Parallel for: elements on worker thread 1       : 1     (size: 63)^M
Parallel for: elements on worker thread 2       : 3     (size: 68)^M
Parallel for: elements on worker thread 3       : 3     (size: 486)^M
Parallel for: elements on worker thread 4       : 0     (size: 0)^M
Parallel for: elements on worker thread 5       : 0     (size: 0)^M
Parallel for: elements on worker thread 6       : 0     (size: 0)^M
Parallel for: elements on worker thread 7       : 0     (size: 0)^M
Parallel for: elements on worker thread 8       : 0     (size: 0)^M
Parallel for: elements on worker thread 9       : 0     (size: 0)^M
Parallel for: elements on worker thread 10      : 0     (size: 0)^M
Parallel for: elements on worker thread 11      : 0     (size: 0)^M
Parallel for: elements on main thread           : 1     (size: 0)^M
...
we can conclude that the 5th CU is in the 3rd shard, and the 6th CU is in the
4th shard.

So we managed to catch the inter-shard case.

[ It would be good to have a parallel-for mode that reserves a shard per item,
such that we can enforce this, independent of factors like amount of
worker-threads. ]

FWIW, also if we set worker-threads to 0, this still fails.  Both the
inter-shard and the intra-shard inter-cu case are broken.

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

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

* [Bug symtab/30846] [gdb/symtab] incorrect parent for forward spec (inter-cu case)
  2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
@ 2023-10-02 12:54 ` vries at gcc dot gnu.org
  2024-01-18 15:41 ` tromey at sourceware dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-10-02 12:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-October/202889.html

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

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

* [Bug symtab/30846] [gdb/symtab] incorrect parent for forward spec (inter-cu case)
  2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
  2023-10-02 12:54 ` [Bug symtab/30846] " vries at gcc dot gnu.org
@ 2024-01-18 15:41 ` tromey at sourceware dot org
  2024-02-09 19:42 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2024-01-18 15:41 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

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

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2024-January/205989.html

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

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

* [Bug symtab/30846] [gdb/symtab] incorrect parent for forward spec (inter-cu case)
  2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
  2023-10-02 12:54 ` [Bug symtab/30846] " vries at gcc dot gnu.org
  2024-01-18 15:41 ` tromey at sourceware dot org
@ 2024-02-09 19:42 ` tromey at sourceware dot org
  2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2024-02-09 19:42 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |29366


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=29366
[Bug 29366] [meta] New DWARF indexer meta bug
-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug symtab/30846] [gdb/symtab] incorrect parent for forward spec (inter-cu case)
  2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-02-09 19:42 ` tromey at sourceware dot org
@ 2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
  2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-16 17:55 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4320a9c921db0245e9486bf3144a326434919f15

commit 4320a9c921db0245e9486bf3144a326434919f15
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Jan 12 18:29:52 2024 -0700

    Correctly handle DIE parent computations

    Tom de Vries pointed out that the combination of sharding,
    multi-threading, and per-CU "racing" means that sometimes a cross-CU
    DIE reference might not be correctly resolved.  However, it's
    important to handle this correctly, due to some unfortunate aspects of
    DWARF.

    This patch implements this by arranging to preserve each worker's DIE
    map through the end of index finalization.  The extra data is
    discarded when finalization is done.  This approach also allows the
    parent name resolution to be sharded, by integrating it into the
    existing entry finalization loop.

    In an earlier review, I remarked that addrmap couldn't be used here.
    However, I was mistaken.  A *mutable* addrmap cannot be used, as those
    are based on splay trees and restructure the tree even during lookups
    (and thus aren't thread-safe).  A fixed addrmap, on the other hand, is
    just a vector and is thread-safe.

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

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

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

* [Bug symtab/30846] [gdb/symtab] incorrect parent for forward spec (inter-cu case)
  2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
@ 2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
  2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
  2024-04-16 17:57 ` tromey at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-16 17:55 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ec9a843791b2d542575c27d7f5f154388765761e

commit ec9a843791b2d542575c27d7f5f154388765761e
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Sep 24 12:33:59 2023 +0200

    [gdb/testsuite] Add gdb.dwarf2/forward-spec-inter-cu.exp

    Add a regression test for PR symtab/30846.

    Tested on x86_64-linux.

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

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

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

* [Bug symtab/30846] [gdb/symtab] incorrect parent for forward spec (inter-cu case)
  2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
@ 2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
  2024-04-16 17:57 ` tromey at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-16 17:55 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6732c57eeea61d72ad1046fae1dd0d00920150e1

commit 6732c57eeea61d72ad1046fae1dd0d00920150e1
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Sep 24 12:30:10 2023 +0200

    [gdb/testsuite] Add gdb.dwarf2/backward-spec-inter-cu.exp

    Add another regression test for PR symtab/30846.

    Tested on x86_64-linux.

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

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

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

* [Bug symtab/30846] [gdb/symtab] incorrect parent for forward spec (inter-cu case)
  2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
@ 2024-04-16 17:57 ` tromey at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2024-04-16 17:57 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.1
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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

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

end of thread, other threads:[~2024-04-16 17:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 14:32 [Bug symtab/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case) vries at gcc dot gnu.org
2023-10-02 12:54 ` [Bug symtab/30846] " vries at gcc dot gnu.org
2024-01-18 15:41 ` tromey at sourceware dot org
2024-02-09 19:42 ` tromey at sourceware dot org
2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
2024-04-16 17:55 ` cvs-commit at gcc dot gnu.org
2024-04-16 17:57 ` 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).