* monitor.h: Add the function regname to monitor_ops

structure. This way NUM_REGS does not have to be a constant.
* monitor.c (monitor_fetch_register): Added support for regname
function. The function is called if the array regnames is NULL.
(monitor_store_register): Same.
* cpu32bug-rom.c (cpu32bug_regname):  Add function. Replaces regnames array.
(init_cpu32bug_cmds): set cpu32bug_cmds.regnames to NULL,
cpu32bug_cmds.regname to point to new function.
* abug-rom.c (abug_regname): Same as above.
(init_abug_cmds): Same.
* dbug-rom.c (dbug_regname): Same as above.
(init_dbug_cmds): Same.
* remote-est.c (est_regname): Same.
(init_est_cmds): Same.
* rom68k-rom.c (rom68k_regname): Same.
(init_rom68k_cmds): Same.
This commit is contained in:
Grace Sainsbury 2002-06-26 15:14:32 +00:00
parent eb3f2f5cfd
commit 1c617db829
8 changed files with 124 additions and 33 deletions

View File

@ -1,3 +1,22 @@
2002-06-26 Grace Sainsbury <graces@redhat.com>
* monitor.h: Add the function regname to monitor_ops
structure. This way NUM_REGS does not have to be a constant.
* monitor.c (monitor_fetch_register): Added support for regname
function. The function is called if the array regnames is NULL.
(monitor_store_register): Same.
* cpu32bug-rom.c (cpu32bug_regname): Add function. Replaces regnames array.
(init_cpu32bug_cmds): set cpu32bug_cmds.regnames to NULL,
cpu32bug_cmds.regname to point to new function.
* abug-rom.c (abug_regname): Same as above.
(init_abug_cmds): Same.
* dbug-rom.c (dbug_regname): Same as above.
(init_dbug_cmds): Same.
* remote-est.c (est_regname): Same.
(init_est_cmds): Same.
* rom68k-rom.c (rom68k_regname): Same.
(init_rom68k_cmds): Same.
2002-06-25 Tom Tromey <tromey@redhat.com>
* breakpoint.c (delete_command): Don't repeat `delete' commands.

View File

@ -76,12 +76,22 @@ abug_supply_register (char *regname, int regnamelen, char *val, int vallen)
* registers either. So, typing "info reg sp" becomes an "A7".
*/
static char *abug_regnames[NUM_REGS] =
static const char *
abug_regname (int index)
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"PC",
};
static char *regnames[] =
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"PC",
};
if ((index >= (sizeof (regnames) / sizeof (regnames[0])))
|| (index < 0) || (index >= NUM_REGS))
return NULL;
else
return regnames[index];
}
/*
* Define the monitor command strings. Since these are passed directly
@ -141,7 +151,8 @@ init_abug_cmds (void)
abug_cmds.cmd_end = NULL; /* optional command terminator */
abug_cmds.target = &abug_ops; /* target operations */
abug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
abug_cmds.regnames = abug_regnames; /* registers names */
abug_cmds.regnames = NULL; /* registers names */
abug_cmds.regname = abug_regname;
abug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
};

View File

@ -74,12 +74,22 @@ cpu32bug_supply_register (char *regname, int regnamelen, char *val, int vallen)
* registers either. So, typing "info reg sp" becomes an "A7".
*/
static char *cpu32bug_regnames[NUM_REGS] =
static const char *
cpu32bug_regname (int index)
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"SR", "PC",
};
static char *regnames[] =
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"SR", "PC"
};
if ((index >= (sizeof (regnames) / sizeof (regnames[0])))
|| (index < 0) || (index >= NUM_REGS))
return NULL;
else
return regnames[index];
}
/*
* Define the monitor command strings. Since these are passed directly
@ -139,7 +149,8 @@ init_cpu32bug_cmds (void)
cpu32bug_cmds.cmd_end = NULL; /* optional command terminator */
cpu32bug_cmds.target = &cpu32bug_ops; /* target operations */
cpu32bug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
cpu32bug_cmds.regnames = cpu32bug_regnames; /* registers names */
cpu32bug_cmds.regnames = NULL; /* registers names */
cpu32bug_cmds.regname = cpu32bug_regname;
cpu32bug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
}; /* init_cpu32bug_cmds */

View File

@ -76,13 +76,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 +147,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 */

View File

@ -1183,7 +1183,10 @@ monitor_fetch_register (int regno)
zerobuf = alloca (MAX_REGISTER_RAW_SIZE);
memset (zerobuf, 0, MAX_REGISTER_RAW_SIZE);
name = current_monitor->regnames[regno];
if (current_monitor->regname != NULL)
name = current_monitor->regname (regno);
else
name = current_monitor->regnames[regno];
monitor_debug ("MON fetchreg %d '%s'\n", regno, name ? name : "(null name)");
if (!name || (*name == '\0'))
@ -1335,8 +1338,12 @@ monitor_store_register (int regno)
{
char *name;
ULONGEST val;
name = current_monitor->regnames[regno];
if (current_monitor->regname != NULL)
name = current_monitor->regname (regno);
else
name = current_monitor->regnames[regno];
if (!name || (*name == '\0'))
{
monitor_debug ("MON Cannot store unknown register\n");

View File

@ -116,6 +116,9 @@ struct monitor_ops
struct target_ops *target; /* target operations */
int stopbits; /* number of stop bits */
char **regnames; /* array of register names in ascii */
/* deprecated: use regname instead */
const char *(*regname) (int index);
/* function for dynamic regname array */
int num_breakpoints; /* If set_break != NULL, number of supported
breakpoints */
int magic; /* Check value */

View File

@ -76,12 +76,24 @@ est_supply_register (char *regname, int regnamelen, char *val, int vallen)
* registers either. So, typing "info reg sp" becomes a "r30".
*/
static char *est_regnames[NUM_REGS] =
static char *
est_regname (int index)
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"SR", "PC",
};
static char *regnames[] =
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"SR", "PC",
};
if ((index >= (sizeof (regnames) / sizeof (regnames[0])))
|| (index < 0) || (index >= NUM_REGS))
return NULL;
else
return regnames[index];
}
/*
* Define the monitor command strings. Since these are passed directly
@ -143,7 +155,8 @@ init_est_cmds (void)
est_cmds.cmd_end = NULL; /* optional command terminator */
est_cmds.target = &est_ops; /* target operations */
est_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
est_cmds.regnames = est_regnames; /* registers names */
est_cmds.regnames = NULL;
est_cmds.regname = est_regname; /*register names*/
est_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
} /* init_est_cmds */

View File

@ -157,11 +157,24 @@ rom68k_supply_register (char *regname, int regnamelen, char *val, int vallen)
than does GDB, and don't necessarily support all the registers
either. So, typing "info reg sp" becomes a "r30". */
static char *rom68k_regnames[NUM_REGS] =
static const char *
rom68k_regname (int index)
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
"SR", "PC"};
static char *regnames[] =
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
"SR", "PC"
};
if ((index >= (sizeof (regnames) / sizeof(regnames[0])))
|| (index < 0) || (index >= NUM_REGS))
return NULL;
else
return regnames[index];
}
/* Define the monitor command strings. Since these are passed directly
through to a printf style function, we may include formatting
@ -220,7 +233,8 @@ init_rom68k_cmds (void)
rom68k_cmds.cmd_end = ".\r";
rom68k_cmds.target = &rom68k_ops;
rom68k_cmds.stopbits = SERIAL_1_STOPBITS;
rom68k_cmds.regnames = rom68k_regnames;
rom68k_cmds.regnames = NULL;
rom68k_cmds.regname = rom68k_regname;
rom68k_cmds.magic = MONITOR_OPS_MAGIC;
} /* init_rom68k_cmds */