diff options
author | Tom de Vries <tdevries@suse.de> | 2021-02-25 15:41:49 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-02-25 15:41:49 +0100 |
commit | 30c80d8833c037f25dd144a64f7f8b7b3ab19027 (patch) | |
tree | 27e27c1cd33ef5e1181fc070b03f89e3d1c777ae /gdb | |
parent | 3c27360bc40ea05cd20bda72617aff707a5b951e (diff) | |
download | gdb-30c80d8833c037f25dd144a64f7f8b7b3ab19027.zip gdb-30c80d8833c037f25dd144a64f7f8b7b3ab19027.tar.gz gdb-30c80d8833c037f25dd144a64f7f8b7b3ab19027.tar.bz2 |
[gdb/symtab] Fix wrong unit_type Dwarf Error
When running test-case gdb.dwarf2/fission-mix.exp using gcc-11 (and using the
tentative fix for PR27353 to get past that assertion failure), I run into:
...
(gdb) file fission-mix^M
Reading symbols from fission-mix...^M
Dwarf Error: wrong unit_type in compilation unit header \
(is DW_UT_split_compile (0x05), should be DW_UT_type (0x02)) \
[in module fission-mix2.dwo]^M
(No debugging symbols found in fission-mix)^M
...
The compilation unit that is complained about is:
...
Contents of the .debug_info.dwo section (loaded from fission-mix2.dwo):
Compilation Unit @ offset 0x0:
Length: 0x57 (32-bit)
Version: 5
Unit Type: DW_UT_split_compile (5)
Abbrev Offset: 0x0
Pointer Size: 8
DWO ID: 0x3e3930d3cc1805df
<0><14>: Abbrev Number: 1 (DW_TAG_compile_unit)
...
And the dwarf error is triggered here in read_comp_unit_head:
...
case DW_UT_split_compile:
if (section_kind != rcuh_kind::COMPILE)
error (_("Dwarf Error: wrong unit_type in compilation unit header "
"(is %s, should be %s) [in module %s]"),
dwarf_unit_type_name (cu_header->unit_type),
dwarf_unit_type_name (DW_UT_type), filename);
break;
...
due to passing rcuh_kind::TYPE here in open_and_init_dwo_file:
...
create_debug_type_hash_table (per_objfile, dwo_file.get (),
&dwo_file->sections.info, dwo_file->tus,
rcuh_kind::TYPE);
...
Fix this by changing the section_kind argument to create_debug_type_hash_table
to rcuh_kind::COMPILE, to reflect that we're passing &dwo_file->sections.info
rather than &dwo_file->sections.types.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-02-25 Tom de Vries <tdevries@suse.de>
PR symtab/27354
* dwarf2/read.c (open_and_init_dwo_file): Use rcuh_kind::COMPILE as
section_kind for &dwo_file->sections.info.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a6a842f..019e7ac 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-02-25 Tom de Vries <tdevries@suse.de> + + PR symtab/27354 + * dwarf2/read.c (open_and_init_dwo_file): Use rcuh_kind::COMPILE as + section_kind for &dwo_file->sections.info. + 2021-02-25 Andrew Burgess <andrew.burgess@embecosm.com> PR fortran/26155 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index df7dd16..7ab5d71 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12987,7 +12987,7 @@ open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name, { create_debug_type_hash_table (per_objfile, dwo_file.get (), &dwo_file->sections.info, dwo_file->tus, - rcuh_kind::TYPE); + rcuh_kind::COMPILE); } dwarf_read_debug_printf ("DWO file found: %s", dwo_name); |