]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/symtab] Handle invalid partial DIE reference
authorTom de Vries <tdevries@suse.de>
Tue, 4 Aug 2020 09:16:37 +0000 (11:16 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 4 Aug 2020 09:16:37 +0000 (11:16 +0200)
When reverting commit 9cfd2b89bd "[gdb/testsuite] Fix
gdb.arch/amd64-entry-value-paramref.S", we run into an internal-error:
...
(gdb) file amd64-entry-value-paramref^M
Reading symbols from amd64-entry-value-paramref...^M
src/gdb/dwarf2/read.c:18903: internal-error: could not find partial DIE
  0x1b7 in cache [from module amd64-entry-value-paramref]^M

A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
...
because of invalid dwarf.

In contrast, when using -readnow, we have:
...
(gdb) file -readnow amd64-entry-value-paramref
Reading symbols from amd64-entry-value-paramref...
Expanding full symbols from amd64-entry-value-paramref...
Dwarf Error: Cannot find DIE at 0x1b7 referenced from DIE at 0x11a \
  [in module amd64-entry-value-paramref]
(gdb)
...

Change the internal error into a Dwarf Error, such that we have:
...
(gdb) file amd64-entry-value-paramref^M
Reading symbols from amd64-entry-value-paramref...^M
Dwarf Error: Cannot not find DIE at 0x1b7 \
  [from module amd64-entry-value-paramref]^M
^M
(No debugging symbols found in amd64-entry-value-paramref)^M
(gdb)
...

Build and tested on x86_64-linux.

gdb/ChangeLog:

2020-08-04  Tom de Vries  <tdevries@suse.de>

PR symtab/23270
* dwarf2/read.c (find_partial_die): Change internal error into Dwarf
Error.

gdb/ChangeLog
gdb/dwarf2/read.c

index bcd9edae75b5abb2a8c823fc3458c2115a9a2f9a..70268e2c0b611830f2ef5c6885ba3387e5f892c2 100644 (file)
@@ -1,3 +1,9 @@
+2020-08-04  Tom de Vries  <tdevries@suse.de>
+
+       PR symtab/23270
+       * dwarf2/read.c (find_partial_die): Change internal error into Dwarf
+       Error.
+
 2020-08-03  John Baldwin  <jhb@FreeBSD.org>
 
        * syscalls/freebsd.xml: Regenerate.
index bcbffbf0e8b7c7a13a33d933dbffe83b6e93e6dd..f591ef6248955c57f958edff7a47180b1fb00321 100644 (file)
@@ -18900,9 +18900,7 @@ find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
     }
 
   if (pd == NULL)
-    internal_error (__FILE__, __LINE__,
-                   _("could not find partial DIE %s "
-                     "in cache [from module %s]\n"),
+    error (_("Dwarf Error: Cannot not find DIE at %s [from module %s]\n"),
                    sect_offset_str (sect_off), bfd_get_filename (objfile->obfd));
   return { cu, pd };
 }