public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30827] New: [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red
@ 2023-09-06 15:23 vries at gcc dot gnu.org
  2023-09-07  6:57 ` [Bug symtab/30827] " 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-06 15:23 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30827
           Summary: [gdb/symtab, dwarf4-gdb-index] FAIL:
                    gdb.ada/same_enum.exp: print red
           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: ---

With test-case gdb.ada/same_enum.exp and target board dwarf4-gdb-index we run
into:
...
(gdb) print red^M
No definition of "red" in current context.^M
(gdb) FAIL: gdb.ada/same_enum.exp: print red
...

Minimal reproducer:
...
$ gdb -q -batch outputs/gdb.ada/same_enum/a -ex "print red"
No definition of "red" in current context.
...

After adding -readnow, it passes:
...
$ gdb -readnow -q -batch outputs/gdb.ada/same_enum/a -ex "print red"
$1 = red
...
so this looks like an index-related problem.

-- 
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/30827] [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red
  2023-09-06 15:23 [Bug symtab/30827] New: [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red vries at gcc dot gnu.org
@ 2023-09-07  6:57 ` vries at gcc dot gnu.org
  2023-09-07  7:24 ` 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-07  6:57 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
This fixes it:
...
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index e178bb067a9..72848dfc26b 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1205,12 +1205,11 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index
*table,
      all_units, but only in their own hash table.  */

   int counter = 0;
-  int types_counter = 0;
   for (int i = 0; i < per_bfd->all_units.size (); ++i)
     {
       dwarf2_per_cu_data *per_cu = per_bfd->all_units[i].get ();

-      int &this_counter = per_cu->is_debug_types ? types_counter : counter;
+      int &this_counter = counter;

       const auto insertpair = cu_index_htab.emplace (per_cu, this_counter);
       gdb_assert (insertpair.second);
...

-- 
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/30827] [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red
  2023-09-06 15:23 [Bug symtab/30827] New: [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red vries at gcc dot gnu.org
  2023-09-07  6:57 ` [Bug symtab/30827] " vries at gcc dot gnu.org
@ 2023-09-07  7:24 ` vries at gcc dot gnu.org
  2023-09-07 15:09 ` 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-07  7:24 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Regression since commit 844a72efbce ("Simplify gdb_index writing"), so this is
broken in gdb 12 and 13.

-- 
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/30827] [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red
  2023-09-06 15:23 [Bug symtab/30827] New: [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red vries at gcc dot gnu.org
  2023-09-07  6:57 ` [Bug symtab/30827] " vries at gcc dot gnu.org
  2023-09-07  7:24 ` vries at gcc dot gnu.org
@ 2023-09-07 15:09 ` vries at gcc dot gnu.org
  2023-09-07 19:59 ` cvs-commit at gcc dot gnu.org
  2023-09-07 20:00 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-07 15:09 UTC (permalink / raw)
  To: gdb-prs

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

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

-- 
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/30827] [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red
  2023-09-06 15:23 [Bug symtab/30827] New: [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-07 15:09 ` vries at gcc dot gnu.org
@ 2023-09-07 19:59 ` cvs-commit at gcc dot gnu.org
  2023-09-07 20:00 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-07 19:59 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

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

commit be7d5d2c417a842452f5f5d4ed7fc8d058a970bf
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Sep 7 21:59:33 2023 +0200

    [gdb/symtab] Fix gdb-index writing for .debug_types

    With test-case gdb.ada/same_enum.exp and target board dwarf4-gdb-index we
run
    into:
    ...
    (gdb) print red^M
    No definition of "red" in current context.^M
    (gdb) FAIL: gdb.ada/same_enum.exp: print red
    ...

    [ This is a regression since commit 844a72efbce ("Simplify gdb_index
writing"),
    so this is broken in gdb 12 and 13. ]

    The easiest way to see what's going wrong is with readelf.  We have in
section
    .gdb_index:
    ...
    [7194] pck__red:
            2 [static, variable]
            3 [static, variable]
    ...
    which points to the CUs 2 and 3 in the CU list (shown using "2" and "3"),
but
    should be pointing to the TUs 2 and 3 in the TU list (shown using "T2" and
    "T3").

    Fix this by removing the counter / types_counter distinction in
    write_gdbindex, such that we get the expected:
    ...
    [7194] pck__red:
            T2 [static, variable]
            T3 [static, variable]
    ...

    [ While reading write_gdbindex I noticed a few oddities related to dwz
    handling, I've filed PR30829 about this. ]

    Tested on x86_64-linux.

    Approved-By: Tom Tromey <tom@tromey.com>

    PR symtab/30827
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30827

-- 
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/30827] [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red
  2023-09-06 15:23 [Bug symtab/30827] New: [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-09-07 19:59 ` cvs-commit at gcc dot gnu.org
@ 2023-09-07 20:00 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-07 20:00 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

-- 
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-09-07 20:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-06 15:23 [Bug symtab/30827] New: [gdb/symtab, dwarf4-gdb-index] FAIL: gdb.ada/same_enum.exp: print red vries at gcc dot gnu.org
2023-09-07  6:57 ` [Bug symtab/30827] " vries at gcc dot gnu.org
2023-09-07  7:24 ` vries at gcc dot gnu.org
2023-09-07 15:09 ` vries at gcc dot gnu.org
2023-09-07 19:59 ` cvs-commit at gcc dot gnu.org
2023-09-07 20:00 ` vries at gcc dot gnu.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).