aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/run-time-clock.cc
diff options
context:
space:
mode:
authorAuthor: Tom Tromey <tom@tromey.com>2024-11-27 18:48:43 +0100
committerTom de Vries <tdevries@suse.de>2024-11-27 18:48:43 +0100
commite33e55b6651f230762ccfe248037263e511b41b3 (patch)
treec8a97ae35a49bd9ba7df72dc8e0f50115bb02e29 /gdbsupport/run-time-clock.cc
parent6f385c1ccdcbfe1d479bbd4407db5ea84299662e (diff)
downloadbinutils-e33e55b6651f230762ccfe248037263e511b41b3.zip
binutils-e33e55b6651f230762ccfe248037263e511b41b3.tar.gz
binutils-e33e55b6651f230762ccfe248037263e511b41b3.tar.bz2
[gdb/symtab] Fix parent map when handling .debug_info and .debug_types
Consider test-case: ... $ cat test.c namespace sp1 { class A { int i; const int f1 = 1; ... const int f29 = 1; }; } sp1::A a; void _start (void) {} $ cat test2.c namespace sp2 { class B { float f; const float f1 = 1; ... const float f29 = 1; }; } sp2::B b; ... compiled like this: ... $ g++ test.c -gdwarf-4 -c -g -fdebug-types-section $ g++ test2.c -gdwarf-5 -c -g -fdebug-types-section $ g++ -g test.o test2.o -nostdlib ... Using: ... $ gdb -q -batch -iex "maint set worker-threads 0" a.out -ex "maint print objfiles" ... we get a cooked index entry with incorrect parent: ... [29] ((cooked_index_entry *) 0x3c57d1a0) name: B canonical: B qualified: sp1::A::B DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x154 parent: ((cooked_index_entry *) 0x3c57d110) [A] ... The problem is that the parent map assumes that all offsets are in the same section. Fix this by using dwarf2_section_info::buffer-relative addresses instead, which get us instead: ... [29] ((cooked_index_entry *) 0x3f0962b0) name: B canonical: B qualified: sp2::B DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x154 parent: ((cooked_index_entry *) 0x3f096280) [sp2] ... Tested on x86_64-linux. PR symtab/32225 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
Diffstat (limited to 'gdbsupport/run-time-clock.cc')
0 files changed, 0 insertions, 0 deletions