[binutils-gdb] [gdb/symtab] Handle DW_TAG_type_unit in process_psymtab_comp_unit

Tom de Vries vries@sourceware.org
Fri Feb 5 16:47:16 GMT 2021


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

commit e77b0004dd114d6ddf3bb92b521b2854341f3f85
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Feb 5 17:47:07 2021 +0100

    [gdb/symtab] Handle DW_TAG_type_unit in process_psymtab_comp_unit
    
    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.

Diff:
---
 gdb/ChangeLog     | 5 +++++
 gdb/dwarf2/read.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e4a5ed88782..8c2953aa8cc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-05  Tom de Vries  <tdevries@suse.de>
+
+	PR symtab/27333
+	* dwarf2/read.c (process_psymtab_comp_unit): Handle DW_TAG_type_unit.
+
 2021-02-05  Tom de Vries  <tdevries@suse.de>
 
 	PR breakpoints/27313
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index f60e418172c..3f60ce6a4f1 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7836,6 +7836,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 ();
     }


More information about the Gdb-cvs mailing list