2003-01-09 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / dve3900-rom.c
index 5c6755a3bb0f29d6774baa62d0ebf2e602d09776..c8834e927956dff6629307a1ca2665b1e0bc34f1 100644 (file)
@@ -1,6 +1,6 @@
 /* Remote debugging interface for Densan DVE-R3900 ROM monitor for
    GDB, the GNU debugger.
-   Copyright 1997 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -28,6 +28,7 @@
 #include "command.h"
 #include "gdb_string.h"
 #include <time.h>
+#include "regcache.h"
 
 /* Type of function passed to bfd_map_over_sections.  */
 
@@ -112,7 +113,7 @@ static int ethernet = 0;
    different names than GDB does, and don't support all the registers
    either.  */
 
-static char *r3900_regnames[NUM_REGS] =
+static char *r3900_regnames[] =
 {
   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -455,8 +456,15 @@ fetch_bitmapped_register (int regno, struct bit_field *bf)
 {
   unsigned long val;
   unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
+  char *regname = NULL;
 
-  monitor_printf ("x%s\r", r3900_regnames[regno]);
+  if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
+    internal_error (__FILE__, __LINE__,
+                    "fetch_bitmapped_register: regno out of bounds");
+  else
+    regname = r3900_regnames[regno];
+
+  monitor_printf ("x%s\r", regname);
   val = fetch_fields (bf);
   monitor_printf (".\r");
   monitor_expect_prompt (NULL, 0);
@@ -500,9 +508,16 @@ static void
 store_bitmapped_register (int regno, struct bit_field *bf)
 {
   unsigned long oldval, newval;
+  char *regname = NULL;
+
+  if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
+    internal_error (__FILE__, __LINE__,
+                    "fetch_bitmapped_register: regno out of bounds");
+  else
+    regname = r3900_regnames[regno];
 
   /* Fetch the current value of the register.  */
-  monitor_printf ("x%s\r", r3900_regnames[regno]);
+  monitor_printf ("x%s\r", regname);
   oldval = fetch_fields (bf);
   newval = read_register (regno);
 
@@ -926,7 +941,7 @@ r3900_load (char *filename, int from_tty)
   if (exec_bfd)
     write_pc (bfd_get_start_address (exec_bfd));
 
-  inferior_pid = 0;            /* No process now */
+  inferior_ptid = null_ptid;           /* No process now */
 
   /* This is necessary because many things were based on the PC at the
      time that we attached to the monitor, which is no longer valid
This page took 0.025543 seconds and 4 git commands to generate.