aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-08-02 18:08:31 +0000
committerAndrew Cagney <cagney@redhat.com>2002-08-02 18:08:31 +0000
commit68365089fc7e8091f6b10a724a499f0e405721d4 (patch)
treef5f6df0b89c1b90b38a2e9d89b2305d0199144b2
parentd8124050fd13563f995362c89e3ac581ec282678 (diff)
downloadfsf-binutils-gdb-68365089fc7e8091f6b10a724a499f0e405721d4.zip
fsf-binutils-gdb-68365089fc7e8091f6b10a724a499f0e405721d4.tar.gz
fsf-binutils-gdb-68365089fc7e8091f6b10a724a499f0e405721d4.tar.bz2
Add the cooked register interface.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/regcache.c32
-rw-r--r--gdb/regcache.h5
3 files changed, 37 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 97b6d5b..6928244 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2002-08-02 Andrew Cagney <ac131313@redhat.com>
+
+ * regcache.c (regcache_cooked_read): New function.
+ (regcache_cooked_write): New function.
+ (read_register_gen): Rewrite using regcache_cooked_read.
+ (write_register_gen): Rewrite using regcache_cooked_write.
+
+ * regcache.h (regcache_cooked_read, regcache_cooked_write):
+ Declare.
+
2002-08-02 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (pseudo_register_read, pseudo_register_write):
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 7d4a8d6..70af8f0 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -719,16 +719,21 @@ read_register_gen (int regnum, char *buf)
legacy_read_register_gen (regnum, buf);
return;
}
+ regcache_cooked_read (current_regcache, regnum, buf);
+}
+
+void
+regcache_cooked_read (struct regcache *regcache, int rawnum, void *buf)
+{
gdb_assert (regnum >= 0);
- gdb_assert (regnum < current_regcache->descr->nr_cooked_registers);
- if (regnum < current_regcache->descr->nr_raw_registers)
- regcache_raw_read (current_regcache, regnum, buf);
+ gdb_assert (regnum < regcache->descr->nr_cooked_registers);
+ if (regnum < regcache->descr->nr_raw_registers)
+ regcache_raw_read (regcache, regnum, buf);
else
- gdbarch_pseudo_register_read (current_gdbarch, current_regcache,
- regnum, buf);
+ gdbarch_pseudo_register_read (regcache->descr->gdbarch, 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. */
@@ -834,12 +839,19 @@ write_register_gen (int regnum, char *buf)
legacy_write_register_gen (regnum, buf);
return;
}
+ regcache_cooked_write (current_regcache, regnum, buf);
+}
+
+void
+regcache_cooked_write (struct regcache *regcache, int rawnum,
+ const void *buf)
+{
gdb_assert (regnum >= 0);
- gdb_assert (regnum < current_regcache->descr->nr_cooked_registers);
- if (regnum < current_regcache->descr->nr_raw_registers)
- regcache_raw_write (current_regcache, regnum, buf);
+ gdb_assert (regnum < regcache->descr->nr_cooked_registers);
+ if (regnum < regcache->descr->nr_raw_registers)
+ regcache_raw_write (regcache, regnum, buf);
else
- gdbarch_pseudo_register_write (current_gdbarch, current_regcache,
+ gdbarch_pseudo_register_write (regcache->descr->gdbarch, regcache,
regnum, buf);
}
diff --git a/gdb/regcache.h b/gdb/regcache.h
index cd5bb83..5ca7bab 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -41,6 +41,11 @@ void regcache_raw_write (struct regcache *regcache, int rawnum,
int regcache_valid_p (struct regcache *regcache, int regnum);
CORE_ADDR regcache_raw_read_as_address (struct regcache *regcache, int rawnum);
+/* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS). */
+void regcache_cooked_read (struct regcache *regcache, int rawnum, void *buf);
+void regcache_cooked_write (struct regcache *regcache, int rawnum,
+ const void *buf);
+
/* Transfer a raw register [0..NUM_REGS) between the regcache and the
target. These functions are called by the target in response to a
target_fetch_registers() or target_store_registers(). */