summaryrefslogtreecommitdiffstats
path: root/contrib/gdb/gdb/dbug-rom.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gdb/gdb/dbug-rom.c')
-rw-r--r--contrib/gdb/gdb/dbug-rom.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/contrib/gdb/gdb/dbug-rom.c b/contrib/gdb/gdb/dbug-rom.c
index f315557..a592334 100644
--- a/contrib/gdb/gdb/dbug-rom.c
+++ b/contrib/gdb/gdb/dbug-rom.c
@@ -32,6 +32,8 @@
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
static void dbug_open (char *args, int from_tty);
static void
@@ -57,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;
@@ -76,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;
@@ -135,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 */
@@ -145,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)
{
OpenPOWER on IntegriCloud