diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-28 15:28:26 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-28 15:28:26 -0400 |
commit | 0c1bcd23274e9f465dc43eda4fc467150631f824 (patch) | |
tree | a7ebad33d064631f80c6b016da5cb3e2df3eedae /gdb/hppa-tdep.c | |
parent | f07fad95a949b070e51a18276b8f1e03cf86490f (diff) | |
download | fsf-binutils-gdb-0c1bcd23274e9f465dc43eda4fc467150631f824.zip fsf-binutils-gdb-0c1bcd23274e9f465dc43eda4fc467150631f824.tar.gz fsf-binutils-gdb-0c1bcd23274e9f465dc43eda4fc467150631f824.tar.bz2 |
gdb: convert obj_section macros to methods
Convert these three macros to methods of obj_section. The problem fixed
by the following patch is caused by an out of bound access of the
objfile::section_offsets vector. Since this is deep in macros, we don't
get a clear backtrace and it's difficult to debug. Changing that to
methods means we can step in them and break on them.
Because their implementation requires knowing about struct objfile, move
struct obj_section below struct objfile in objfiles.h.
The obj_section_offset was used in one place as an lvalue to set
offsets, in machoread.c. Replace that with a set_offset method.
Add the objfile::section_offset and objfile::set_section_offset methods
to improve encapsulation (reduce other objects poking into struct
objfile's internals).
gdb/ChangeLog:
* objfiles.h (struct obj_section): Move down.
<offset, set_offset, addr, endaddr>: New.
(obj_section_offset, obj_section_addr, obj_section_endaddr),
replace all users to use obj_section methods.
(struct objfile) <section_offset, set_section_offset>: New.
Change-Id: I97e8fcae93ab2353fbdadcb4a5ec10d7949a7334
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r-- | gdb/hppa-tdep.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 21e58f3..ffb3394 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -943,11 +943,7 @@ hppa64_convert_code_addr_to_fptr (struct gdbarch *gdbarch, CORE_ADDR code) if (opd < sec->objfile->sections_end) { - CORE_ADDR addr; - - for (addr = obj_section_addr (opd); - addr < obj_section_endaddr (opd); - addr += 2 * 8) + for (CORE_ADDR addr = opd->addr (); addr < opd->endaddr (); addr += 2 * 8) { ULONGEST opdaddr; gdb_byte tmp[8]; |