summaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-03-12 20:50:13 +0000
committerAndrew Cagney <cagney@redhat.com>2003-03-12 20:50:13 +0000
commit439bccad32f796d9fa2989ce43675d5a8a6e8be7 (patch)
tree06a6ae7d9ac7264f6b6eccb26ac0e2ee04f306f8 /gdb/regcache.c
parent1981b4178ea65cce5552fc37a3a5c9e9399fef96 (diff)
downloadgdb-439bccad32f796d9fa2989ce43675d5a8a6e8be7.tar.gz
2003-03-12 Andrew Cagney <cagney@redhat.com>
* regcache.c (regcache_cooked_write_signed): New function. (regcache_cooked_write_unsigned): New function. (regcache_cooked_read_unsigned): Fix regnum in range assertion. (regcache_cooked_read_signed): Fix regnum in range assertion. * regcache.h (regcache_cooked_write_signed): Declare. (regcache_cooked_write_unsigned): Declare.
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 5475cf681ef..c66901780ae 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. */