Re: [PATCH 18/24] gdb: migrate i386 and amd64 to the new gdbarch_pseudo_register_write

John Baldwin
2023-11-11T20:17:06Z

On 11/7/23 9:01 PM, Simon Marchi wrote:
> From: Simon Marchi <simon.marchi@efficios.com>
>
> Make i386 and amd64 use the new gdbarch_pseudo_register_write. This
> fixes writing to pseudo registers in non-current frames for those
> architectures.
>
> Change-Id: I4977e8fe12d2cef116f8834c34cdf6fec618554f
> ---
> gdb/amd64-tdep.c | 39 +++----------
> gdb/i386-tdep.c | 146 +++++++++++++++++------------------------------
> gdb/i386-tdep.h | 6 +-
> gdb/value.c | 3 +-
> gdb/value.h | 6 +-
> 5 files changed, 66 insertions(+), 134 deletions(-)
>
> diff --git a/gdb/value.c b/gdb/value.c
> index 51dca972a587..5c18bb17a781 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -4062,7 +4062,8 @@ pseudo_to_raw_part (frame_info_ptr next_frame,
> gdb::array_view<const gdb_byte> pseudo_buf,
> int raw_reg_num, int raw_offset)
> {
> - int raw_reg_size = register_size (get_frame_arch (next_frame), raw_reg_num);
> + int raw_reg_size
> + = register_size (frame_unwind_arch (next_frame), raw_reg_num);
>
> /* When overflowing a register, put_frame_register_bytes writes to the
> subsequent registers. We don't want that behavior here, so make sure
> diff --git a/gdb/value.h b/gdb/value.h
> index 6a74d4e2c2ee..3b3cb9c00982 100644
> --- a/gdb/value.h
> +++ b/gdb/value.h
> @@ -1664,7 +1664,7 @@ value *pseudo_from_raw_part (frame_info_ptr next_frame, int pseudo_reg_num,
> /* Write PSEUDO_BUF, the contents of a pseudo register, to part of raw register
> RAW_REG_NUM starting at RAW_OFFSET. */
>
> -void pseudo_to_raw_part (frame_info_ptr this_frame,
> +void pseudo_to_raw_part (frame_info_ptr next_frame,
> gdb::array_view<const gdb_byte> pseudo_buf,
> int raw_reg_num, int raw_offset);
>
> @@ -1680,7 +1680,7 @@ value *pseudo_from_concat_raw (frame_info_ptr next_frame, int pseudo_reg_num,
> /* Write PSEUDO_BUF, the contents of a pseudo register, to the two raw registers
> RAW_REG_1_NUM and RAW_REG_2_NUM. */
>
> -void pseudo_to_concat_raw (frame_info_ptr this_frame,
> +void pseudo_to_concat_raw (frame_info_ptr next_frame,
> gdb::array_view<const gdb_byte> pseudo_buf,
> int raw_reg_1_num, int raw_reg_2_num);
>
> @@ -1693,7 +1693,7 @@ value *pseudo_from_concat_raw (frame_info_ptr next_frame, int pseudo_reg_num,
> /* Write PSEUDO_BUF, the contents of a pseudo register, to the tthreewo raw
> registers RAW_REG_1_NUM, RAW_REG_2_NUM and RAW_REG_3_NUM. */
>
> -void pseudo_to_concat_raw (frame_info_ptr this_frame,
> +void pseudo_to_concat_raw (frame_info_ptr next_frame,
> gdb::array_view<const gdb_byte> pseudo_buf,
> int raw_reg_1_num, int raw_reg_2_num,
> int raw_reg_3_num);

Should these value.[ch] changes be part of the previous patch (17) instead?

Otherwise, the amd64/i386 parts look good to me.

--
John Baldwin