aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-12-01 11:27:26 -0500
committerSimon Marchi <simon.marchi@efficios.com>2023-12-14 16:04:49 +0000
commit6831f2cd547e6e18b2245a4f325f9960b1e732ec (patch)
tree1f09e017c5205ab833394b7ebe73dd40f31b443d /gdb/regcache.c
parent9fc79b423697825f7afcb4f1143edd3827711c4c (diff)
downloadgdb-6831f2cd547e6e18b2245a4f325f9960b1e732ec.zip
gdb-6831f2cd547e6e18b2245a4f325f9960b1e732ec.tar.gz
gdb-6831f2cd547e6e18b2245a4f325f9960b1e732ec.tar.bz2
gdb: add value::allocate_register
Add value::allocate_register, to facilitate allocating a value representing a register in a given frame (or rather, in the given frame's previous frame). It will be used in a subsequent patch. I changed one relatively obvious spot that could use it, to at least exercise the code path. Change-Id: Icd4960f5e471a74b657bb3596c88d89679ef3772 Reviewed-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 19ba353..9b3fd4f 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -775,11 +775,8 @@ readable_regcache::cooked_read_value (int regnum)
|| (m_has_pseudo && m_register_status[regnum] != REG_UNKNOWN)
|| !gdbarch_pseudo_register_read_value_p (m_descr->gdbarch))
{
- struct value *result;
-
- result = value::allocate (register_type (m_descr->gdbarch, regnum));
- result->set_lval (lval_register);
- VALUE_REGNUM (result) = regnum;
+ value *result = value::allocate_register
+ (get_next_frame_sentinel_okay (get_current_frame ()), regnum);
/* It is more efficient in general to do this delegation in this
direction than in the other one, even though the value-based