diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2025-04-29 15:31:45 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2025-04-29 15:44:08 -0400 |
commit | 2b9f9de4e4cbd2ee62b0993c5fd74fc24150a26c (patch) | |
tree | 93c5da2be17fb82eae691f7ce829918fcb7ab6cd /gdb/python/py-param.c | |
parent | e352e8b044ebfe2a0ed31be43f6d57cf1a041a7e (diff) | |
download | binutils-2b9f9de4e4cbd2ee62b0993c5fd74fc24150a26c.zip binutils-2b9f9de4e4cbd2ee62b0993c5fd74fc24150a26c.tar.gz binutils-2b9f9de4e4cbd2ee62b0993c5fd74fc24150a26c.tar.bz2 |
gdb/dwarf: scan .debug_info.dwo just once
When building -gsplit-dwarf and -fdebug-types-section in DWARF 5, the
resulting .dwo files will typically have a .debug_info.dwo section with
multiple type units followed by one compile unit:
$ llvm-dwarfdump -F -color a-test.dwo | grep ' Unit'
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)
0x000008a4: Type Unit: length = 0x00000099, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_type, abbr_offset = 0x0000, addr_size = 0x08, name = 'allocator<int>', type_signature = 0x496a8791a842701b, type_offset = 0x0023 (next unit at 0x00000941)
...
0x000015c1: Compile Unit: length = 0x00000f58, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset = 0x0000, addr_size = 0x08, DWO_id = 0xe8e359820d1c5803 (next unit at 0x0000251d)
In open_and_init_dwo_file, we call create_dwo_cus_hash_table, which
scans the section, looking for compile units, then call
create_dwo_debug_types_hash_table, which scans the section again,
looking for type units. It would make more sense to scan the section
just once and handle both compile and type units at the same time.
To achieve this, add create_dwo_unit_hash_tables, which knows how to
handle both unit kinds in a single scan. It replaces
create_dwo_cus_hash_table and create_dwo_debug_type_hash_table. Change
open_and_init_dwo_file to call it.
Note that I removed the DWARF version check in open_and_init_dwo_file
when processing .debug_type.dwo sections: in DWARF 5, the
.debug_type.dwo sections will just not exist, so the
`dwo_file->sections.types` vector will be empty.
Change-Id: I6e51d0ca06c258e0bf0e59927d62ae2df314a162
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python/py-param.c')
0 files changed, 0 insertions, 0 deletions