Pass REGISTER_RAW_SIZE to sim_{fetch,store}_register. Verify returned

register size.
This commit is contained in:
Andrew Cagney 1998-02-17 04:28:00 +00:00
parent fbb8b6b9ab
commit bccb2e7f89
2 changed files with 18 additions and 6 deletions

View File

@ -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

View File

@ -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);