aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 5475cf68..c669017 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -884,7 +884,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum,
{
char *buf;
gdb_assert (regcache != NULL);
- gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+ gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
regcache_cooked_read (regcache, regnum, buf);
(*val) = extract_signed_integer (buf,
@@ -897,13 +897,37 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
{
char *buf;
gdb_assert (regcache != NULL);
- gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+ gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
regcache_cooked_read (regcache, regnum, buf);
(*val) = extract_unsigned_integer (buf,
regcache->descr->sizeof_register[regnum]);
}
+void
+regcache_cooked_write_signed (struct regcache *regcache, int regnum,
+ LONGEST val)
+{
+ void *buf;
+ gdb_assert (regcache != NULL);
+ gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
+ buf = alloca (regcache->descr->sizeof_register[regnum]);
+ store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
+ regcache_cooked_write (regcache, regnum, buf);
+}
+
+void
+regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
+ ULONGEST val)
+{
+ void *buf;
+ gdb_assert (regcache != NULL);
+ gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
+ buf = alloca (regcache->descr->sizeof_register[regnum]);
+ store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
+ regcache_cooked_write (regcache, regnum, buf);
+}
+
/* Write register REGNUM at MYADDR to the target. MYADDR points at
REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order. */