diff options
author | Tom Tromey <tom@tromey.com> | 2020-02-20 18:22:09 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-02-20 18:22:09 -0700 |
commit | 22b6cd70430d6bdaa3ae6c01414de8fd1f15a556 (patch) | |
tree | 8d65a7bf4b91e78340ba60d39033a649abb7a78e /gdb/ppc-sysv-tdep.c | |
parent | 54b2aec10df9ad032184c556ec9cc3f611a91830 (diff) | |
download | gdb-22b6cd70430d6bdaa3ae6c01414de8fd1f15a556.zip gdb-22b6cd70430d6bdaa3ae6c01414de8fd1f15a556.tar.gz gdb-22b6cd70430d6bdaa3ae6c01414de8fd1f15a556.tar.bz2 |
Fix latent bug in dwarf2_find_containing_comp_unit
dwarf2_find_containing_comp_unit has this in its binary search:
if (mid_cu->is_dwz > offset_in_dwz
|| (mid_cu->is_dwz == offset_in_dwz
&& mid_cu->sect_off + mid_cu->length >= sect_off))
high = mid;
The intent here is to determine whether SECT_OFF appears in or before
MID_CU.
I believe this has an off-by-one error, and that the check should use
">" rather than ">=". If the two side are equal, then SECT_OFF
actually appears at the start of the next CU.
I've had this patch kicking around for ages but I forget how I found
the problem.
gdb/ChangeLog
2020-02-20 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_find_containing_comp_unit): Use ">", not
">=", in binary search.
(dwarf2_find_containing_comp_unit): New overload.
(run_test): New self-test.
(_initialize_dwarf2_read): Register new test.
Diffstat (limited to 'gdb/ppc-sysv-tdep.c')
0 files changed, 0 insertions, 0 deletions