diff options
author | Tom de Vries <tdevries@suse.de> | 2019-08-09 06:49:04 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2019-08-09 06:49:04 +0200 |
commit | eba4caf23152a1a66d10ce37c502ec78654cd5eb (patch) | |
tree | ce04049ed9ed4644954febfadbe51e800db27dde /gdb | |
parent | 378646f7a4260eecd244ba840ae1af4e663e30a5 (diff) | |
download | gdb-eba4caf23152a1a66d10ce37c502ec78654cd5eb.zip gdb-eba4caf23152a1a66d10ce37c502ec78654cd5eb.tar.gz gdb-eba4caf23152a1a66d10ce37c502ec78654cd5eb.tar.bz2 |
[gdb] Fix gdb.dwarf2/varval.exp with -fPIE/-pie
With target board unix/-fPIE/-pie, we get:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...
This is due comparing a get_frame_pc result (which includes the for PIE
non-zero relocation offset) with pc_high and pc_low obtained using
get_scope_pc_bounds (which do not include the relocation offset).
Fix this by adjusting pc_high and pc_low with the relocation offset.
Tested on x86_64-linux with target board unix/-fPIE/-pie.
gdb/ChangeLog:
2019-08-09 Tom de Vries <tdevries@suse.de>
PR gdb/24591
* dwarf2read.c (dwarf2_fetch_die_loc_sect_off): Adjust pc_high and
pc_low with relocation offset.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 04bb14e..6e6390c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-08-09 Tom de Vries <tdevries@suse.de> + + PR gdb/24591 + * dwarf2read.c (dwarf2_fetch_die_loc_sect_off): Adjust pc_high and + pc_low with relocation offset. + 2019-08-07 Tom Tromey <tromey@adacore.com> * stack.c (print_frame_arg, read_frame_local, read_frame_arg) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 1c26f83..de9755f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -23206,6 +23206,9 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, != dwarf2_per_objfile->abstract_to_concrete.end ())) { CORE_ADDR pc = (*get_frame_pc) (baton); + CORE_ADDR baseaddr + = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); + struct gdbarch *gdbarch = get_objfile_arch (objfile); for (const auto &cand_off : dwarf2_per_objfile->abstract_to_concrete[die->sect_off]) @@ -23220,8 +23223,11 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, CORE_ADDR pc_low, pc_high; get_scope_pc_bounds (cand->parent, &pc_low, &pc_high, cu); - if (pc_low == ((CORE_ADDR) -1) - || !(pc_low <= pc && pc < pc_high)) + if (pc_low == ((CORE_ADDR) -1)) + continue; + pc_low = gdbarch_adjust_dwarf2_addr (gdbarch, pc_low + baseaddr); + pc_high = gdbarch_adjust_dwarf2_addr (gdbarch, pc_high + baseaddr); + if (!(pc_low <= pc && pc < pc_high)) continue; die = cand; |