aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1998-02-17 04:28:00 +0000
committerAndrew Cagney <cagney@redhat.com>1998-02-17 04:28:00 +0000
commitbccb2e7f89c67edc89322284e3f06f23278983d0 (patch)
treea8860bf7eab8d2e711057b91c60b1e9bd5fce03b
parentfbb8b6b9abf5890f5b88b114a88cdf895b6ada96 (diff)
downloadbinutils-bccb2e7f89c67edc89322284e3f06f23278983d0.zip
binutils-bccb2e7f89c67edc89322284e3f06f23278983d0.tar.gz
binutils-bccb2e7f89c67edc89322284e3f06f23278983d0.tar.bz2
Pass REGISTER_RAW_SIZE to sim_{fetch,store}_register. Verify returned
register size.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/remote-sim.c18
2 files changed, 18 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c59ba9d..80e7ec7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+Tue Feb 17 14:32:18 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register):
+ Pass register size to sim_{fetch,store}_register. Check nr of
+ register bytes transfered is correct.
+
Mon Feb 16 14:05:54 1998 Andrew Cagney <cagney@b1.cygnus.com>
* remote-d10v.c (remote_d10v_open): Call push_remote_target
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 69c474a..70f3221 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -337,7 +337,7 @@ gdb_os_error (p, va_alist)
static void
gdbsim_fetch_register (regno)
-int regno;
+ int regno;
{
if (regno == -1)
{
@@ -347,8 +347,12 @@ int regno;
else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
{
char buf[MAX_REGISTER_RAW_SIZE];
-
- sim_fetch_register (gdbsim_desc, regno, buf);
+ int nr_bytes = sim_fetch_register (gdbsim_desc, regno, buf, REGISTER_RAW_SIZE (regno));
+ if (nr_bytes == 0)
+ /* register not applicable, supply zero's */
+ memset (buf, 0, MAX_REGISTER_RAW_SIZE);
+ else if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno))
+ fatal ("Register size different to expected");
supply_register (regno, buf);
if (sr_get_debug ())
{
@@ -362,7 +366,7 @@ int regno;
static void
gdbsim_store_register (regno)
-int regno;
+ int regno;
{
if (regno == -1)
{
@@ -371,10 +375,12 @@ int regno;
}
else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
{
- /* FIXME: Until read_register() returns LONGEST, we have this. */
char tmp[MAX_REGISTER_RAW_SIZE];
+ int nr_bytes;
read_register_gen (regno, tmp);
- sim_store_register (gdbsim_desc, regno, tmp);
+ nr_bytes = sim_store_register (gdbsim_desc, regno, tmp, REGISTER_RAW_SIZE (regno));
+ if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno))
+ fatal ("Register size different to expected");
if (sr_get_debug ())
{
printf_filtered ("gdbsim_store_register: %d", regno);