public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
@ 2021-08-24 15:22 vries at gcc dot gnu.org
  2021-08-24 15:36 ` [Bug symtab/28261] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-24 15:22 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28261
           Summary: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No
                    complaints
           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 current trunk, we run into:
...
(gdb) file
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-ranges-psym/dw2-ranges-psym^M
Reading symbols from
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-ranges-psym/dw2-ranges-psym...^M
warning: Section .debug_names in
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-ranges-psym/dw2-ranges-psym
has abbreviation_table of size 1 vs. written as 28, ignoring .debug_names.^M
(gdb) set complaints 0^M
(gdb) FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
...

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

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

* [Bug symtab/28261] [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
  2021-08-24 15:22 [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints vries at gcc dot gnu.org
@ 2021-08-24 15:36 ` vries at gcc dot gnu.org
  2021-08-25  7:47 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-24 15:36 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Bisects to:
...
commit 5ef670d81fd222ae5edfa1428ad48710f5e10d35 (HEAD)
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Aug 23 12:08:25 2021 +0200

    [gdb/testsuite] Add dummy start and end CUs in dwarf assembly
...

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

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

* [Bug symtab/28261] [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
  2021-08-24 15:22 [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints vries at gcc dot gnu.org
  2021-08-24 15:36 ` [Bug symtab/28261] " vries at gcc dot gnu.org
@ 2021-08-25  7:47 ` vries at gcc dot gnu.org
  2021-08-25  7:50 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-25  7:47 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
So we have these CUs:
...
$ readelf -wi ./outputs/gdb.dwarf2/dw2-ranges-psym/dw2-ranges-psym | grep @
  Compilation Unit @ offset 0x0:
  Compilation Unit @ offset 0x2e:
  Compilation Unit @ offset 0xa5:
  Compilation Unit @ offset 0xc7:
  Compilation Unit @ offset 0xd2:
  Compilation Unit @ offset 0x145:
  Compilation Unit @ offset 0x150:
  Compilation Unit @ offset 0x308:
...
with 0xc7 a dummy CU:
...
  Compilation Unit @ offset 0xc7:
   Length:        0x7 (32-bit)
   Version:       4
   Abbrev Offset: 0x64
   Pointer Size:  8
  Compilation Unit @ offset 0xd2:
...
as well as 0x145:
...
  Compilation Unit @ offset 0x145:
   Length:        0x7 (32-bit)
   Version:       4
   Abbrev Offset: 0xaa
   Pointer Size:  8
  Compilation Unit @ offset 0x150:
...

And in the .debug_names section we have:
...
Version 5
Augmentation string: 47 44 42 00  ("GDB")
CU table:
[  0] 0x0
[  1] 0x2e
[  2] 0xa5
[  3] 0xd2
[  4] 0x150
[  5] 0x308
[  6] 0x1
[  7] 0x0
...
The entries for the dummy CUs are missing, and the last two entries are
incorrect.

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

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

* [Bug symtab/28261] [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
  2021-08-24 15:22 [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints vries at gcc dot gnu.org
  2021-08-24 15:36 ` [Bug symtab/28261] " vries at gcc dot gnu.org
  2021-08-25  7:47 ` vries at gcc dot gnu.org
@ 2021-08-25  7:50 ` vries at gcc dot gnu.org
  2021-08-25  8:18 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-25  7:50 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by:
...
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 4e00c716d91..813c19ef850 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1428,16 +1428,10 @@ write_debug_names (dwarf2_per_objfile *per_objfile,
        = per_objfile->per_bfd->all_comp_units[i].get ();
       partial_symtab *psymtab = per_cu->v.psymtab;

-      /* CU of a shared file from 'dwz -m' may be unused by this main
-        file.  It may be referenced from a local scope but in such
-        case it does not need to be present in .debug_names.  */
-      if (psymtab == NULL)
-       continue;
-
       int &this_counter = per_cu->is_debug_types ? types_counter : counter;
       data_buf &this_list = per_cu->is_debug_types ? types_cu_list : cu_list;

-      if (psymtab->user == NULL)
+      if (psymtab != nullptr && psymtab->user == nullptr)
        nametable.recursively_write_psymbols (objfile, psymtab, psyms_seen,
                                              this_counter);

...
which gives us:
...
CU table:
[  0] 0x0
[  1] 0x2e
[  2] 0xa5
[  3] 0xc7
[  4] 0xd2
[  5] 0x145
[  6] 0x150
[  7] 0x308
...

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

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

* [Bug symtab/28261] [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
  2021-08-24 15:22 [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-08-25  7:50 ` vries at gcc dot gnu.org
@ 2021-08-25  8:18 ` vries at gcc dot gnu.org
  2021-08-26 12:00 ` vries at gcc dot gnu.org
  2021-09-14 11:10 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-25  8:18 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Alternatively, we can do:
...
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 4e00c716d91..7333e2b2d55 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1481,14 +1481,11 @@ write_debug_names (dwarf2_per_objfile *per_objfile,
   header.append_uint (2, dwarf5_byte_order, 0);

   /* comp_unit_count - The number of CUs in the CU list.  */
-  header.append_uint (4, dwarf5_byte_order,
-                     per_objfile->per_bfd->all_comp_units.size ()
-                     - per_objfile->per_bfd->tu_stats.nr_tus);
+  header.append_uint (4, dwarf5_byte_order, counter);

   /* local_type_unit_count - The number of TUs in the local TU
      list.  */
-  header.append_uint (4, dwarf5_byte_order,
-                     per_objfile->per_bfd->tu_stats.nr_tus);
+  header.append_uint (4, dwarf5_byte_order, types_counter);

   /* foreign_type_unit_count - The number of TUs in the foreign TU
      list.  */
...
which gives us:
...
CU table:
[  0] 0x0
[  1] 0x2e
[  2] 0xa5
[  3] 0xd2
[  4] 0x150
[  5] 0x308
...
but then we run into:
...
$ gdb -q -batch \
  -ex "set trace-commands on" \
  -x outputs/gdb.dwarf2/dw2-ranges-psym/gdb.in.6
+set height 0
+set width 0
+dir
+dir /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.dwarf2
+show complaints
Max number of complaints about incorrect symbols is 0.
+set complaints 5
+file ./outputs/gdb.dwarf2/dw2-ranges-psym/dw2-ranges-psym
+set complaints 0
+delete breakpoints
+info breakpoints
No breakpoints or watchpoints.
+break -qualified main
Breakpoint 1 at 0x4004ab
+run 

Breakpoint 1, 0x00000000004004ab in main ()
+break someothername
src/gdb/dwarf2/read.c:6627: internal-error:
cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*,
abbrev_table*, dwarf2_cu*, bool): Assertion `this_cu->length ==
cu->header.get_length ()' failed.
...

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

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

* [Bug symtab/28261] [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
  2021-08-24 15:22 [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-08-25  8:18 ` vries at gcc dot gnu.org
@ 2021-08-26 12:00 ` vries at gcc dot gnu.org
  2021-09-14 11:10 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-26 12:00 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2021-August/181672.html

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

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

* [Bug symtab/28261] [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
  2021-08-24 15:22 [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-08-26 12:00 ` vries at gcc dot gnu.org
@ 2021-09-14 11:10 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-14 11:10 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=2762d288534f48dc8653524b878883472037a57c
:

[gdb/symtab] Fix CU list in .debug_names for dummy CUs

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

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

end of thread, other threads:[~2021-09-14 11:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 15:22 [Bug symtab/28261] New: [debug-names] FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints vries at gcc dot gnu.org
2021-08-24 15:36 ` [Bug symtab/28261] " vries at gcc dot gnu.org
2021-08-25  7:47 ` vries at gcc dot gnu.org
2021-08-25  7:50 ` vries at gcc dot gnu.org
2021-08-25  8:18 ` vries at gcc dot gnu.org
2021-08-26 12:00 ` vries at gcc dot gnu.org
2021-09-14 11:10 ` 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).