]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: fix frame passed to gdbarch_value_to_register in value_assign
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 11 Jan 2024 16:41:04 +0000 (11:41 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 11 Jan 2024 18:11:19 +0000 (13:11 -0500)
commit47ff07a6c283a39fa3b8c92d823c8851678dfc0f
tree6197067697917b5a2a6685c66ce9d961d270296f
parentfa87f8e1958b8937047e3d5fcfd8c265745710ae
gdb: fix frame passed to gdbarch_value_to_register in value_assign

Commit 78f2fd84e83 ("gdb: remove VALUE_REGNUM, add value::regnum")
introduced an unexpected change in value_assign.  It replaced
`get_prev_frame_always (next_frame)` with `next_frame`in the call to
gdbarch_value_to_register.

This is the result of a merge error, since I previously had a patch to
change gdbarch_value_to_register to take the next frame, and later
decided to drop it.  Revert that change.

Add a test based on the DWARF assembler to expose the problem and test
the fix.  I also tested on ppc64le to make sure the problem reported in
PR 31231 was fixed.

Change-Id: Ib8b851287ac27a4b2e386f7b680cf65865e6aee6
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31231
gdb/testsuite/gdb.dwarf2/assign-variable-value-to-register.exp [new file with mode: 0644]
gdb/valops.c