* gdb.base/attach.exp (do_attach_tests): Don't forget to kill second
[deliverable/binutils-gdb.git] / gdb / dbug-rom.c
index dff1a3be3afd831f531cebe6f118c0546a763182..a592334ea05a254c3f5e0450b0d369603eb06f52 100644 (file)
@@ -1,5 +1,5 @@
 /* Remote debugging interface to dBUG ROM monitor for GDB, the GNU debugger.
-   Copyright 1996, 1999 Free Software Foundation, Inc.
+   Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    Written by Stan Shebs of Cygnus Support.
 
@@ -30,6 +30,9 @@
 #include "target.h"
 #include "monitor.h"
 #include "serial.h"
+#include "regcache.h"
+
+#include "m68k-tdep.h"
 
 static void dbug_open (char *args, int from_tty);
 
@@ -56,12 +59,12 @@ dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
     case 'D':
       if (regname[1] < '0' || regname[1] > '7')
        return;
-      regno = regname[1] - '0' + D0_REGNUM;
+      regno = regname[1] - '0' + M68K_D0_REGNUM;
       break;
     case 'A':
       if (regname[1] < '0' || regname[1] > '7')
        return;
-      regno = regname[1] - '0' + A0_REGNUM;
+      regno = regname[1] - '0' + M68K_A0_REGNUM;
       break;
     default:
       return;
@@ -75,13 +78,25 @@ dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
    different names than GDB does, and don't support all the registers
    either. So, typing "info reg sp" becomes an "A7". */
 
-static char *dbug_regnames[NUM_REGS] =
+static const char *
+dbug_regname (int index)
 {
-  "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
-  "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
-  "SR", "PC"
-  /* no float registers */
-};
+  static char *regnames[] =
+  {
+    "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
+    "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
+    "SR", "PC"
+    /* no float registers */
+  };
+
+  if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) 
+      || (index < 0) || (index >= NUM_REGS))
+    return NULL;
+  else
+    return regnames[index];
+
+}
+
 static struct target_ops dbug_ops;
 static struct monitor_ops dbug_cmds;
 
@@ -134,7 +149,8 @@ init_dbug_cmds (void)
   dbug_cmds.cmd_end = NULL;    /* optional command terminator */
   dbug_cmds.target = &dbug_ops;        /* target operations */
   dbug_cmds.stopbits = SERIAL_1_STOPBITS;      /* number of stop bits */
-  dbug_cmds.regnames = dbug_regnames;  /* registers names */
+  dbug_cmds.regnames = NULL;   /* registers names */
+  dbug_cmds.regname = dbug_regname;
   dbug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
 }                              /* init_debug_ops */
 
@@ -144,6 +160,8 @@ dbug_open (char *args, int from_tty)
   monitor_open (args, &dbug_cmds, from_tty);
 }
 
+extern initialize_file_ftype _initialize_dbug_rom; /* -Wmissing-prototypes */
+
 void
 _initialize_dbug_rom (void)
 {
This page took 0.025457 seconds and 4 git commands to generate.