]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/symtab] Handle DW_TAG_type_unit in process_psymtab_comp_unit
authorTom de Vries <tdevries@suse.de>
Fri, 5 Feb 2021 16:47:07 +0000 (17:47 +0100)
committerJoel Brobecker <brobecker@adacore.com>
Sat, 6 Mar 2021 06:34:13 +0000 (10:34 +0400)
When running test-case gdb.cp/cpexprs-debug-types.exp with target board
unix/gdb:debug_flags=-gdwarf-5, I run into:
...
(gdb) file cpexprs-debug-types^M
Reading symbols from cpexprs-debug-types...^M
ERROR: Couldn't load cpexprs-debug-types into GDB (eof).
ERROR: Couldn't send delete breakpoints to GDB.
ERROR: GDB process no longer exists
GDB process exited with wait status 23054 exp9 0 0 CHILDKILLED SIGABRT SIGABRT
...

We're running into this abort in process_psymtab_comp_unit:
...
  switch (reader.comp_unit_die->tag)
    {
    case DW_TAG_compile_unit:
      this_cu->unit_type = DW_UT_compile;
      break;
    case DW_TAG_partial_unit:
      this_cu->unit_type = DW_UT_partial;
      break;
    default:
      abort ();
    }
...
because reader.comp_unit_die->tag == DW_TAG_type_unit.

Fix this by adding a DW_TAG_type_unit case.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-02-05  Tom de Vries  <tdevries@suse.de>

PR symtab/27333
* dwarf2/read.c (process_psymtab_comp_unit): Handle DW_TAG_type_unit.

(cherry picked from commit e77b0004dd114d6ddf3bb92b521b2854341f3f85)

gdb/ChangeLog
gdb/dwarf2/read.c

index 9e70cea383726fdac5b106e90338ad456747dcfa..1f73b18f8df65771833604617dece2bb9ff65f2d 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-06  Tom de Vries  <tdevries@suse.de>
+
+       PR symtab/27333
+       * dwarf2/read.c (process_psymtab_comp_unit): Handle DW_TAG_type_unit.
+
 2021-03-04  Simon Marchi  <simon.marchi@polymtl.ca>
 
        PR gdb/27147
index df00f01f28570d5408e91458f68a357a7b1fcccd..a025f04f48d0fe3edaa1664956844ca7979a2143 100644 (file)
@@ -7708,6 +7708,9 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu,
     case DW_TAG_partial_unit:
       this_cu->unit_type = DW_UT_partial;
       break;
+    case DW_TAG_type_unit:
+      this_cu->unit_type = DW_UT_type;
+      break;
     default:
       abort ();
     }