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/30846] New: [gdb/symtab] incorrect parent for forward spec (inter-cu case)
Date: Wed, 13 Sep 2023 14:32:04 +0000	[thread overview]
Message-ID: <bug-30846-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-09-13 14:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 14:32 vries at gcc dot gnu.org [this message]
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

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