public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/29453] New: [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed
@ 2022-08-07  6:59 vries at gcc dot gnu.org
  2022-08-07  7:02 ` [Bug symtab/29453] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-07  6:59 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29453
           Summary: [gdb/symtab] read.h:309: internal-error: set_length:
                    Assertion `m_length == length' failed
           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 this change:
...
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names.exp
b/gdb/testsuite/gdb.dwarf2/debug-names.exp
index 0af5a93bea8..f82e53d5cba 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names.exp
@@ -29,7 +29,7 @@ set func_info_vars \
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble {
     filename $asm_file
-    add_dummy_cus 0
+    add_dummy_cus 1
 } {
     global func_info_vars
     foreach var $func_info_vars {
...
we run into:
...
(gdb) break _start^M
/home/vries/gdb_versions/devel/src/gdb/dwarf2/read.h:309: internal-error:
set_length: Assertion `m_length == length' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
----- Backtrace -----^M
FAIL: gdb.dwarf2/debug-names.exp: gdb_breakpoint: set breakpoint at _start (GDB
internal error)
...

There are 3 CUs:
...
$ readelf -wi outputs/gdb.dwarf2/debug-names/debug-names | grep @
  Compilation Unit @ offset 0x0:
  Compilation Unit @ offset 0xb:
  Compilation Unit @ offset 0x38:
...
but the CU list in .debug_names only contains one:
...
Contents of the .debug_names section:

Version 5
Augmentation string: 47 44 42 00  ("GDB")
CU table:
[  0] 0xb

TU table:
...

The length of the CU at 0xb is calculated in create_cus_from_debug_names_list
as if the CU at 0x38 is also a part of it.

Then when doing full expansion, the actual CU header is read, and we find out
the size is different:
...
#6  0x0000000000718b2f in dwarf2_per_cu_data::set_length (this=0x2cdc870,
length=45, strict_p=true) at read.h:309
309           gdb_assert (m_length == length);
(gdb) p m_length
$1 = 56
(gdb) p length
$2 = 45
...

-- 
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/29453] [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed
  2022-08-07  6:59 [Bug symtab/29453] New: [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed vries at gcc dot gnu.org
@ 2022-08-07  7:02 ` vries at gcc dot gnu.org
  2022-08-07  8:01 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-07  7:02 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
A simple fix is, don't calculate length based on the CU list:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index c65a8831bcb..7253c7c0d3e 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -4677,7 +4677,7 @@ create_cus_from_debug_names_list (dwarf2_per_bfd *per_bf
d,
                         " ignoring .debug_names."));
              return false;
            }
-         const ULONGEST length = sect_off_next - sect_off_prev;
+         const ULONGEST length = 0;
          dwarf2_per_cu_data_up per_cu
            = create_cu_from_index_list (per_bfd, &section, is_dwz,
                                         sect_off_prev, length);
...

-- 
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/29453] [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed
  2022-08-07  6:59 [Bug symtab/29453] New: [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed vries at gcc dot gnu.org
  2022-08-07  7:02 ` [Bug symtab/29453] " vries at gcc dot gnu.org
@ 2022-08-07  8:01 ` vries at gcc dot gnu.org
  2022-08-09 12:36 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-07  8:01 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> A simple fix is, don't calculate length based on the CU list:
> ...
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index c65a8831bcb..7253c7c0d3e 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -4677,7 +4677,7 @@ create_cus_from_debug_names_list (dwarf2_per_bfd
> *per_bf
> d,
>                          " ignoring .debug_names."));
>               return false;
>             }
> -         const ULONGEST length = sect_off_next - sect_off_prev;
> +         const ULONGEST length = 0;
>           dwarf2_per_cu_data_up per_cu
>             = create_cu_from_index_list (per_bfd, &section, is_dwz,
>                                          sect_off_prev, length);
> ...

Tested this, no regressions.

-- 
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/29453] [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed
  2022-08-07  6:59 [Bug symtab/29453] New: [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed vries at gcc dot gnu.org
  2022-08-07  7:02 ` [Bug symtab/29453] " vries at gcc dot gnu.org
  2022-08-07  8:01 ` vries at gcc dot gnu.org
@ 2022-08-09 12:36 ` vries at gcc dot gnu.org
  2022-09-01  6:41 ` vries at gcc dot gnu.org
  2022-09-14  8:46 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-09 12:36 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-August/191313.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/29453] [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed
  2022-08-07  6:59 [Bug symtab/29453] New: [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-08-09 12:36 ` vries at gcc dot gnu.org
@ 2022-09-01  6:41 ` vries at gcc dot gnu.org
  2022-09-14  8:46 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-01  6:41 UTC (permalink / raw)
  To: gdb-prs

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

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

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

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

-- 
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/29453] [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed
  2022-08-07  6:59 [Bug symtab/29453] New: [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-09-01  6:41 ` vries at gcc dot gnu.org
@ 2022-09-14  8:46 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-14  8:46 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> (In reply to Tom de Vries from comment #1)
> > A simple fix is, don't calculate length based on the CU list:
> > ...
> > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> > index c65a8831bcb..7253c7c0d3e 100644
> > --- a/gdb/dwarf2/read.c
> > +++ b/gdb/dwarf2/read.c
> > @@ -4677,7 +4677,7 @@ create_cus_from_debug_names_list (dwarf2_per_bfd
> > *per_bf
> > d,
> >                          " ignoring .debug_names."));
> >               return false;
> >             }
> > -         const ULONGEST length = sect_off_next - sect_off_prev;
> > +         const ULONGEST length = 0;
> >           dwarf2_per_cu_data_up per_cu
> >             = create_cu_from_index_list (per_bfd, &section, is_dwz,
> >                                          sect_off_prev, length);
> > ...
> 
> Tested this, no regressions.

Hmm, I may have forgot to test cc-with-debug-names board:
https://sourceware.org/bugzilla/show_bug.cgi?id=29572

-- 
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:[~2022-09-14  8:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07  6:59 [Bug symtab/29453] New: [gdb/symtab] read.h:309: internal-error: set_length: Assertion `m_length == length' failed vries at gcc dot gnu.org
2022-08-07  7:02 ` [Bug symtab/29453] " vries at gcc dot gnu.org
2022-08-07  8:01 ` vries at gcc dot gnu.org
2022-08-09 12:36 ` vries at gcc dot gnu.org
2022-09-01  6:41 ` vries at gcc dot gnu.org
2022-09-14  8:46 ` 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).