diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-12-01 11:27:24 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-12-14 16:04:49 +0000 |
commit | 534dcbcb80957fffe9d9d55b02b5c9db20002bcf (patch) | |
tree | eddb01b59b21afecb833e7e9a1e51c273abed0d1 | |
parent | 584468de6c4c305eac9e89801b82406a3fdb3c3b (diff) | |
download | fsf-binutils-gdb-534dcbcb80957fffe9d9d55b02b5c9db20002bcf.zip fsf-binutils-gdb-534dcbcb80957fffe9d9d55b02b5c9db20002bcf.tar.gz fsf-binutils-gdb-534dcbcb80957fffe9d9d55b02b5c9db20002bcf.tar.bz2 |
gdb: make put_frame_register_bytes take the next frame
Similar to the previous patches, change put_frame_register_bytes to take
the "next frame" instead of "this frame".
Change-Id: I27bcb26573686d99b231230823cff8db6405a788
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
-rw-r--r-- | gdb/dwarf2/expr.c | 6 | ||||
-rw-r--r-- | gdb/frame.c | 14 | ||||
-rw-r--r-- | gdb/frame.h | 4 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 11 | ||||
-rw-r--r-- | gdb/valops.c | 32 |
5 files changed, 31 insertions, 36 deletions
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index b21016e..7fc7b3a 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -272,9 +272,9 @@ rw_pieced_value (value *v, value *from, bool check_optimized) copy_bitwise (buffer.data (), bits_to_skip % 8, from_contents, offset, this_size_bits, bits_big_endian); - put_frame_register_bytes (frame, gdb_regnum, - bits_to_skip / 8, - buffer); + put_frame_register_bytes + (get_next_frame_sentinel_okay (frame), gdb_regnum, + bits_to_skip / 8, buffer); } } break; diff --git a/gdb/frame.c b/gdb/frame.c index 44c4906..982aaa6 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1537,11 +1537,11 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum, } void -put_frame_register_bytes (frame_info_ptr frame, int regnum, +put_frame_register_bytes (frame_info_ptr next_frame, int regnum, CORE_ADDR offset, gdb::array_view<const gdb_byte> buffer) { - struct gdbarch *gdbarch = get_frame_arch (frame); + gdbarch *gdbarch = frame_unwind_arch (next_frame); /* Skip registers wholly inside of OFFSET. */ while (offset >= register_size (gdbarch, regnum)) @@ -1557,19 +1557,15 @@ put_frame_register_bytes (frame_info_ptr frame, int regnum, buffer.size ()); if (curr_len == register_size (gdbarch, regnum)) - put_frame_register (get_next_frame_sentinel_okay (frame), regnum, - buffer.slice (0, curr_len)); + put_frame_register (next_frame, regnum, buffer.slice (0, curr_len)); else { - value *value - = frame_unwind_register_value (frame_info_ptr (frame->next), - regnum); + value *value = frame_unwind_register_value (next_frame, regnum); gdb_assert (value != nullptr); copy (buffer.slice (0, curr_len), value->contents_writeable ().slice (offset, curr_len)); - put_frame_register (get_next_frame_sentinel_okay (frame), regnum, - value->contents_raw ()); + put_frame_register (next_frame, regnum, value->contents_raw ()); release_value (value); } diff --git a/gdb/frame.h b/gdb/frame.h index 1d870d6..5ce3a1b 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -743,8 +743,8 @@ extern bool get_frame_register_bytes (frame_info_ptr frame, int regnum, int *optimizedp, int *unavailablep); /* Write bytes from BUFFER to one or multiple registers starting with REGNUM - in frame FRAME, starting at OFFSET. */ -extern void put_frame_register_bytes (frame_info_ptr frame, int regnum, + in NEXT_FRAME's previous frame, starting at OFFSET. */ +extern void put_frame_register_bytes (frame_info_ptr next_frame, int regnum, CORE_ADDR offset, gdb::array_view<const gdb_byte> buffer); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index dbdf8a6..9c0cfed 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -999,7 +999,8 @@ mips_value_to_register (frame_info_ptr frame, int regnum, { gdb_byte fill[8]; size_t len = type->length (); - + frame_info_ptr next_frame = get_next_frame_sentinel_okay (frame); + /* Sign extend values, irrespective of type, that are stored to a 64-bit general purpose register. (32-bit unsigned values are stored as signed quantities within a 64-bit register. @@ -1012,8 +1013,8 @@ mips_value_to_register (frame_info_ptr frame, int regnum, store_signed_integer (fill, 8, BFD_ENDIAN_BIG, -1); else store_signed_integer (fill, 8, BFD_ENDIAN_BIG, 0); - put_frame_register_bytes (frame, regnum, 0, {fill, 8 - len}); - put_frame_register_bytes (frame, regnum, 8 - len, {from, len}); + put_frame_register_bytes (next_frame, regnum, 0, {fill, 8 - len}); + put_frame_register_bytes (next_frame, regnum, 8 - len, {from, len}); } else { @@ -1021,8 +1022,8 @@ mips_value_to_register (frame_info_ptr frame, int regnum, store_signed_integer (fill, 8, BFD_ENDIAN_LITTLE, -1); else store_signed_integer (fill, 8, BFD_ENDIAN_LITTLE, 0); - put_frame_register_bytes (frame, regnum, 0, {from, len}); - put_frame_register_bytes (frame, regnum, len, {fill, 8 - len}); + put_frame_register_bytes (next_frame, regnum, 0, {from, len}); + put_frame_register_bytes (next_frame, regnum, len, {fill, 8 - len}); } } else diff --git a/gdb/valops.c b/gdb/valops.c index a15c92b..eb30a52 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1193,10 +1193,6 @@ value_assign (struct value *toval, struct value *fromval) case lval_register: { - frame_info_ptr frame; - struct gdbarch *gdbarch; - int value_reg; - /* Figure out which frame this register value is in. The value holds the frame_id for the next frame, that is the frame this register value was unwound from. @@ -1204,15 +1200,14 @@ value_assign (struct value *toval, struct value *fromval) Below we will call put_frame_register_bytes which requires that we pass it the actual frame in which the register value is valid, i.e. not the next frame. */ - frame = frame_find_by_id (VALUE_NEXT_FRAME_ID (toval)); - frame = get_prev_frame_always (frame); + frame_info_ptr next_frame = frame_find_by_id (VALUE_NEXT_FRAME_ID (toval)); - value_reg = VALUE_REGNUM (toval); + int value_reg = VALUE_REGNUM (toval); - if (!frame) + if (next_frame == nullptr) error (_("Value being assigned to is no longer active.")); - gdbarch = get_frame_arch (frame); + gdbarch *gdbarch = frame_unwind_arch (next_frame); if (toval->bitsize ()) { @@ -1232,9 +1227,10 @@ value_assign (struct value *toval, struct value *fromval) "don't fit in a %d bit word."), (int) sizeof (LONGEST) * HOST_CHAR_BIT); - if (!get_frame_register_bytes (frame, value_reg, offset, - {buffer, changed_len}, - &optim, &unavail)) + if (!get_frame_register_bytes (get_prev_frame_always (next_frame), + value_reg, offset, + { buffer, changed_len }, &optim, + &unavail)) { if (optim) throw_error (OPTIMIZED_OUT_ERROR, @@ -1247,8 +1243,8 @@ value_assign (struct value *toval, struct value *fromval) modify_field (type, buffer, value_as_long (fromval), toval->bitpos (), toval->bitsize ()); - put_frame_register_bytes (frame, value_reg, offset, - {buffer, changed_len}); + put_frame_register_bytes (next_frame, value_reg, offset, + { buffer, changed_len }); } else { @@ -1258,17 +1254,19 @@ value_assign (struct value *toval, struct value *fromval) /* If TOVAL is a special machine register requiring conversion of program values to a special raw format. */ - gdbarch_value_to_register (gdbarch, frame, + gdbarch_value_to_register (gdbarch, + get_prev_frame_always (next_frame), VALUE_REGNUM (toval), type, fromval->contents ().data ()); } else - put_frame_register_bytes (frame, value_reg, + put_frame_register_bytes (next_frame, value_reg, toval->offset (), fromval->contents ()); } - gdb::observers::register_changed.notify (frame, value_reg); + gdb::observers::register_changed.notify + (get_prev_frame_always (next_frame), value_reg); break; } |