diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2025-04-11 16:38:04 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2025-04-15 10:55:25 -0400 |
commit | 774935aa0c2b10b54509e5816a86f4f2c1c1d9bf (patch) | |
tree | e0191d01e2b50da56bd9a47eb553b2ab718d88ff /gdb/testsuite/gdb.dwarf2/loclists-sec-offset.c | |
parent | fc3696543b42d4805194786faf529e234c290766 (diff) | |
download | binutils-774935aa0c2b10b54509e5816a86f4f2c1c1d9bf.zip binutils-774935aa0c2b10b54509e5816a86f4f2c1c1d9bf.tar.gz binutils-774935aa0c2b10b54509e5816a86f4f2c1c1d9bf.tar.bz2 |
gdb/dwarf: skip type units in create_dwo_cus_hash_table
When compiling with -gsplit-dwarf -fdebug-types-section, DWARF 5
.debug_info.dwo sections may contain some type units:
$ llvm-dwarfdump -F -color a-test.dwo | head -n 5
a-test.dwo: file format elf64-x86-64
.debug_info.dwo contents:
0x00000000: Type Unit: length = 0x000008a0, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_type, abbr_offset = 0x0000, addr_size = 0x08, name = 'vector<int, std::allocator<int> >', type_signature = 0xb499dcf29e2928c4, type_offset = 0x0023 (next unit at 0x000008a4)
In this case, create_dwo_cus_hash_table wrongly creates a dwo_unit for
it and adds it to dwo_file::cus. create_dwo_debug_type_hash_table later
correctly creates a dwo_unit that it puts in dwo_file::tus.
This can be observed with:
$ ./gdb -nx -q --data-directory=data-directory -ex 'maint set dwarf sync on' -ex "maint set worker-threads 0" -ex "set debug dwarf-read 2" -ex "file a.out" -batch
...
[dwarf-read] create_dwo_cus_hash_table: Reading .debug_info.dwo for /home/smarchi/build/binutils-gdb/gdb/a-test.dwo:
[dwarf-read] create_dwo_cus_hash_table: offset 0x0, dwo_id 0xb499dcf29e2928c4
[dwarf-read] create_dwo_cus_hash_table: offset 0x8a4, dwo_id 0x496a8791a842701b
[dwarf-read] create_dwo_cus_hash_table: offset 0x941, dwo_id 0xefd13b3f62ea9fea
...
[dwarf-read] create_dwo_debug_type_hash_table: Reading .debug_info.dwo for /home/smarchi/build/binutils-gdb/gdb/a-test.dwo
[dwarf-read] create_dwo_debug_type_hash_table: offset 0x0, signature 0xb499dcf29e2928c4
[dwarf-read] create_dwo_debug_type_hash_table: offset 0x8a4, signature 0x496a8791a842701b
[dwarf-read] create_dwo_debug_type_hash_table: offset 0x941, signature 0xefd13b3f62ea9fea
...
Fix it by skipping anything that isn't a compile unit in
create_dwo_cus_hash_table. After this patch, the debug output of
create_dwo_cus_hash_table only shows one created dwo_unit, as we expect.
I couldn't find any user-visible problem related to this, I just noticed
it while debugging.
Change-Id: I7dddf766fe1164123b6702027b1beb56114f25b1
Reviewed-By: Tom de Vries <tdevries@suse.de>
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2/loclists-sec-offset.c')
0 files changed, 0 insertions, 0 deletions