diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-12-21 16:28:19 +0000 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2023-12-24 09:02:08 -0500 |
commit | c465f4303776f6609f1ca4835b4bf3627e7c61af (patch) | |
tree | 329c9362f5f9393c3799647f9f66d6a37ab214bd /gdb | |
parent | 8ada4c640ba066a0129cb8c3928f676d1f0fd917 (diff) | |
download | binutils-c465f4303776f6609f1ca4835b4bf3627e7c61af.zip binutils-c465f4303776f6609f1ca4835b4bf3627e7c61af.tar.gz binutils-c465f4303776f6609f1ca4835b4bf3627e7c61af.tar.bz2 |
gdb: remove read_frame_register_value's frame parameter
By now, all register struct values should have a valid next frame id
(assuming they are created using value::allocate_register or
value::allocate_register_lazy), so there should be no need to pass a
frame alongside the value to read_frame_register_value. Remove the
frame parameter and adjust read_frame_register_value accordingly.
While at it, make read_frame_register_value static, it's only used in
findvar.c.
Change-Id: I118959ef8c628499297c67810916e8ba9934bfac
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/findvar.c | 23 | ||||
-rw-r--r-- | gdb/value.h | 3 |
2 files changed, 13 insertions, 13 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c index f48033d..1b7931c 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -767,24 +767,27 @@ default_value_from_register (gdbarch *gdbarch, type *type, int regnum, } /* VALUE must be an lval_register value. If regnum is the value's - associated register number, and len the length of the values type, - read one or more registers in FRAME, starting with register REGNUM, + associated register number, and len the length of the value's type, + read one or more registers in VALUE's frame, starting with register REGNUM, until we've read LEN bytes. If any of the registers we try to read are optimized out, then mark the complete resulting value as optimized out. */ -void -read_frame_register_value (struct value *value, frame_info_ptr frame) +static void +read_frame_register_value (value *value) { - struct gdbarch *gdbarch = get_frame_arch (frame); + gdb_assert (value->lval () == lval_register); + + frame_info_ptr next_frame = frame_find_by_id (VALUE_NEXT_FRAME_ID (value)); + gdb_assert (next_frame != nullptr); + + gdbarch *gdbarch = frame_unwind_arch (next_frame); LONGEST offset = 0; LONGEST reg_offset = value->offset (); int regnum = VALUE_REGNUM (value); int len = type_length_units (check_typedef (value->type ())); - gdb_assert (value->lval () == lval_register); - /* Skip registers wholly inside of REG_OFFSET. */ while (reg_offset >= register_size (gdbarch, regnum)) { @@ -795,7 +798,7 @@ read_frame_register_value (struct value *value, frame_info_ptr frame) /* Copy the data. */ while (len > 0) { - struct value *regval = get_frame_register_value (frame, regnum); + struct value *regval = frame_unwind_register_value (next_frame, regnum); int reg_len = type_length_units (regval->type ()) - reg_offset; /* If the register length is larger than the number of bytes @@ -852,7 +855,7 @@ value_from_register (struct type *type, int regnum, frame_info_ptr frame) v = gdbarch_value_from_register (gdbarch, type, regnum, frame); /* Get the data. */ - read_frame_register_value (v, frame); + read_frame_register_value (v); } return v; @@ -895,7 +898,7 @@ address_from_register (int regnum, frame_info_ptr frame) } value *value = gdbarch_value_from_register (gdbarch, type, regnum, frame); - read_frame_register_value (value, frame); + read_frame_register_value (value); if (value->optimized_out ()) { diff --git a/gdb/value.h b/gdb/value.h index 86ad3ff..c56504b 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1119,9 +1119,6 @@ extern value *default_value_from_register (gdbarch *gdbarch, type *type, int regnum, const frame_info_ptr &this_frame); -extern void read_frame_register_value (struct value *value, - frame_info_ptr frame); - extern struct value *value_from_register (struct type *type, int regnum, frame_info_ptr frame); |