* monitor.c (monitor_supply_register): Add REGCACHE parameter, use
it instead of current_regcache. (parse_register_dump): Add REGCACHE parameter, pass it to supply_register callback. (monitor_dump_reg_block): Add REGCACHE parameter, pass it to parse_register_dump. (monitor_dump_regs): Add REGCACHE parameter, pass it to parse_register_dump and dumpregs callback. (monitor_wait): Pass current_regcache to parse_register_dump and monitor_dump_regs. (monitor_fetch_register): Pass current_regcache to monitor_supply_register. (monitor_fetch_registers): Pass current_regcache to monitor_dump_regs. * monitor.h (struct monitor_ops): Add REGCACHE parameter to supply_register and dumpregs callbacks. (monitor_supply_register, monitor_dump_reg_block): Update prototypes. * dbug-rom.c (dbug_supply_register): Add REGCACHE parameter. Pass it to monitor_supply_register. * dink32-rom.c (dink32_supply_register): Likewise. * ppcbug-rom.c (ppcbug_supply_register): Likewise. * m32r-rom.c (m32r_supply_register): Likewise. Also, use REGCACHE instead of current_regcache.
This commit is contained in:
parent
468e3d5126
commit
c410a84ca9
7 changed files with 73 additions and 39 deletions
|
@ -1,3 +1,30 @@
|
||||||
|
2007-05-06 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
|
* monitor.c (monitor_supply_register): Add REGCACHE parameter, use
|
||||||
|
it instead of current_regcache.
|
||||||
|
(parse_register_dump): Add REGCACHE parameter, pass it to
|
||||||
|
supply_register callback.
|
||||||
|
(monitor_dump_reg_block): Add REGCACHE parameter, pass it to
|
||||||
|
parse_register_dump.
|
||||||
|
(monitor_dump_regs): Add REGCACHE parameter, pass it to
|
||||||
|
parse_register_dump and dumpregs callback.
|
||||||
|
(monitor_wait): Pass current_regcache to parse_register_dump and
|
||||||
|
monitor_dump_regs.
|
||||||
|
(monitor_fetch_register): Pass current_regcache to
|
||||||
|
monitor_supply_register.
|
||||||
|
(monitor_fetch_registers): Pass current_regcache to
|
||||||
|
monitor_dump_regs.
|
||||||
|
* monitor.h (struct monitor_ops): Add REGCACHE parameter to
|
||||||
|
supply_register and dumpregs callbacks.
|
||||||
|
(monitor_supply_register, monitor_dump_reg_block): Update
|
||||||
|
prototypes.
|
||||||
|
* dbug-rom.c (dbug_supply_register): Add REGCACHE parameter. Pass
|
||||||
|
it to monitor_supply_register.
|
||||||
|
* dink32-rom.c (dink32_supply_register): Likewise.
|
||||||
|
* ppcbug-rom.c (ppcbug_supply_register): Likewise.
|
||||||
|
* m32r-rom.c (m32r_supply_register): Likewise. Also, use REGCACHE
|
||||||
|
instead of current_regcache.
|
||||||
|
|
||||||
2007-05-06 Ulrich Weigand <uweigand@de.ibm.com>
|
2007-05-06 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
* i386-nto-tdep.c (i386nto_supply_gregset, i386nto_supply_fpregset):
|
* i386-nto-tdep.c (i386nto_supply_gregset, i386nto_supply_fpregset):
|
||||||
|
|
|
@ -38,7 +38,8 @@
|
||||||
static void dbug_open (char *args, int from_tty);
|
static void dbug_open (char *args, int from_tty);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
dbug_supply_register (struct regcache *regcache, char *regname,
|
||||||
|
int regnamelen, char *val, int vallen)
|
||||||
{
|
{
|
||||||
int regno;
|
int regno;
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_supply_register (regno, val);
|
monitor_supply_register (regcache, regno, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This array of registers needs to match the indexes used by GDB. The
|
/* This array of registers needs to match the indexes used by GDB. The
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
static void dink32_open (char *args, int from_tty);
|
static void dink32_open (char *args, int from_tty);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dink32_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
dink32_supply_register (struct regcache *regcache, char *regname,
|
||||||
|
int regnamelen, char *val, int vallen)
|
||||||
{
|
{
|
||||||
int regno = 0;
|
int regno = 0;
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ dink32_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_supply_register (regno, val);
|
monitor_supply_register (regcache, regno, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This array of registers needs to match the indexes used by GDB. The
|
/* This array of registers needs to match the indexes used by GDB. The
|
||||||
|
|
|
@ -210,7 +210,8 @@ static char *m32r_regnames[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
m32r_supply_register (struct regcache *regcache, char *regname,
|
||||||
|
int regnamelen, char *val, int vallen)
|
||||||
{
|
{
|
||||||
int regno;
|
int regno;
|
||||||
int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
|
int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
|
||||||
|
@ -224,14 +225,14 @@ m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
||||||
|
|
||||||
if (regno == ACCL_REGNUM)
|
if (regno == ACCL_REGNUM)
|
||||||
{ /* special handling for 64-bit acc reg */
|
{ /* special handling for 64-bit acc reg */
|
||||||
monitor_supply_register (ACCH_REGNUM, val);
|
monitor_supply_register (regcache, ACCH_REGNUM, val);
|
||||||
val = strchr (val, ':'); /* skip past ':' to get 2nd word */
|
val = strchr (val, ':'); /* skip past ':' to get 2nd word */
|
||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
monitor_supply_register (ACCL_REGNUM, val + 1);
|
monitor_supply_register (regcache, ACCL_REGNUM, val + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
monitor_supply_register (regno, val);
|
monitor_supply_register (regcache, regno, val);
|
||||||
if (regno == PSW_REGNUM)
|
if (regno == PSW_REGNUM)
|
||||||
{
|
{
|
||||||
unsigned long psw = strtoul (val, NULL, 16);
|
unsigned long psw = strtoul (val, NULL, 16);
|
||||||
|
@ -239,45 +240,45 @@ m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
||||||
|
|
||||||
#ifdef SM_REGNUM
|
#ifdef SM_REGNUM
|
||||||
/* Stack mode bit */
|
/* Stack mode bit */
|
||||||
monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
|
monitor_supply_register (regcache, SM_REGNUM, (psw & 0x80) ? one : zero);
|
||||||
#endif
|
#endif
|
||||||
#ifdef BSM_REGNUM
|
#ifdef BSM_REGNUM
|
||||||
/* Backup stack mode bit */
|
/* Backup stack mode bit */
|
||||||
monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
|
monitor_supply_register (regcache, BSM_REGNUM, (psw & 0x8000) ? one : zero);
|
||||||
#endif
|
#endif
|
||||||
#ifdef IE_REGNUM
|
#ifdef IE_REGNUM
|
||||||
/* Interrupt enable bit */
|
/* Interrupt enable bit */
|
||||||
monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
|
monitor_supply_register (regcache, IE_REGNUM, (psw & 0x40) ? one : zero);
|
||||||
#endif
|
#endif
|
||||||
#ifdef BIE_REGNUM
|
#ifdef BIE_REGNUM
|
||||||
/* Backup interrupt enable bit */
|
/* Backup interrupt enable bit */
|
||||||
monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
|
monitor_supply_register (regcache, BIE_REGNUM, (psw & 0x4000) ? one : zero);
|
||||||
#endif
|
#endif
|
||||||
#ifdef COND_REGNUM
|
#ifdef COND_REGNUM
|
||||||
/* Condition bit (carry etc.) */
|
/* Condition bit (carry etc.) */
|
||||||
monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
|
monitor_supply_register (regcache, COND_REGNUM, (psw & 0x1) ? one : zero);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CBR_REGNUM
|
#ifdef CBR_REGNUM
|
||||||
monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
|
monitor_supply_register (regcache, CBR_REGNUM, (psw & 0x1) ? one : zero);
|
||||||
#endif
|
#endif
|
||||||
#ifdef BPC_REGNUM
|
#ifdef BPC_REGNUM
|
||||||
monitor_supply_register (BPC_REGNUM, zero); /* KLUDGE: (???????) */
|
monitor_supply_register (regcache, BPC_REGNUM, zero); /* KLUDGE: (???????) */
|
||||||
#endif
|
#endif
|
||||||
#ifdef BCARRY_REGNUM
|
#ifdef BCARRY_REGNUM
|
||||||
monitor_supply_register (BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
|
monitor_supply_register (regcache, BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regno == SPI_REGNUM || regno == SPU_REGNUM)
|
if (regno == SPI_REGNUM || regno == SPU_REGNUM)
|
||||||
{ /* special handling for stack pointer (spu or spi) */
|
{ /* special handling for stack pointer (spu or spi) */
|
||||||
ULONGEST stackmode, psw;
|
ULONGEST stackmode, psw;
|
||||||
regcache_cooked_read_unsigned (current_regcache, PSW_REGNUM, &psw);
|
regcache_cooked_read_unsigned (regcache, PSW_REGNUM, &psw);
|
||||||
stackmode = psw & 0x80;
|
stackmode = psw & 0x80;
|
||||||
|
|
||||||
if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
|
if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
|
||||||
monitor_supply_register (SP_REGNUM, val);
|
monitor_supply_register (regcache, SP_REGNUM, val);
|
||||||
else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
|
else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
|
||||||
monitor_supply_register (SP_REGNUM, val);
|
monitor_supply_register (regcache, SP_REGNUM, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ static struct target_ops *targ_ops;
|
||||||
static void monitor_interrupt_query (void);
|
static void monitor_interrupt_query (void);
|
||||||
static void monitor_interrupt_twice (int);
|
static void monitor_interrupt_twice (int);
|
||||||
static void monitor_stop (void);
|
static void monitor_stop (void);
|
||||||
static void monitor_dump_regs (void);
|
static void monitor_dump_regs (struct regcache *regcache);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static int from_hex (int a);
|
static int from_hex (int a);
|
||||||
|
@ -848,7 +848,7 @@ monitor_detach (char *args, int from_tty)
|
||||||
/* Convert VALSTR into the target byte-ordered value of REGNO and store it. */
|
/* Convert VALSTR into the target byte-ordered value of REGNO and store it. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
monitor_supply_register (int regno, char *valstr)
|
monitor_supply_register (struct regcache *regcache, int regno, char *valstr)
|
||||||
{
|
{
|
||||||
ULONGEST val;
|
ULONGEST val;
|
||||||
unsigned char regbuf[MAX_REGISTER_SIZE];
|
unsigned char regbuf[MAX_REGISTER_SIZE];
|
||||||
|
@ -887,7 +887,7 @@ monitor_supply_register (int regno, char *valstr)
|
||||||
|
|
||||||
store_unsigned_integer (regbuf, register_size (current_gdbarch, regno), val);
|
store_unsigned_integer (regbuf, register_size (current_gdbarch, regno), val);
|
||||||
|
|
||||||
regcache_raw_supply (current_regcache, regno, regbuf);
|
regcache_raw_supply (regcache, regno, regbuf);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -926,7 +926,7 @@ monitor_resume (ptid_t ptid, int step, enum target_signal sig)
|
||||||
string which are passed down to monitor specific code. */
|
string which are passed down to monitor specific code. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_register_dump (char *buf, int len)
|
parse_register_dump (struct regcache *regcache, char *buf, int len)
|
||||||
{
|
{
|
||||||
monitor_debug ("MON Parsing register dump\n");
|
monitor_debug ("MON Parsing register dump\n");
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -948,7 +948,8 @@ parse_register_dump (char *buf, int len)
|
||||||
vallen = register_strings.end[2] - register_strings.start[2];
|
vallen = register_strings.end[2] - register_strings.start[2];
|
||||||
val = buf + register_strings.start[2];
|
val = buf + register_strings.start[2];
|
||||||
|
|
||||||
current_monitor->supply_register (regname, regnamelen, val, vallen);
|
current_monitor->supply_register (regcache, regname, regnamelen,
|
||||||
|
val, vallen);
|
||||||
|
|
||||||
buf += register_strings.end[0];
|
buf += register_strings.end[0];
|
||||||
len -= register_strings.end[0];
|
len -= register_strings.end[0];
|
||||||
|
@ -1108,10 +1109,10 @@ monitor_wait (ptid_t ptid, struct target_waitstatus *status)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_monitor->register_pattern)
|
if (current_monitor->register_pattern)
|
||||||
parse_register_dump (buf, resp_len);
|
parse_register_dump (current_regcache, buf, resp_len);
|
||||||
#else
|
#else
|
||||||
monitor_debug ("Wait fetching registers after stop\n");
|
monitor_debug ("Wait fetching registers after stop\n");
|
||||||
monitor_dump_regs ();
|
monitor_dump_regs (current_regcache);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status->kind = TARGET_WAITKIND_STOPPED;
|
status->kind = TARGET_WAITKIND_STOPPED;
|
||||||
|
@ -1227,7 +1228,7 @@ monitor_fetch_register (int regno)
|
||||||
current_monitor->getreg.term_cmd) /* ack expected */
|
current_monitor->getreg.term_cmd) /* ack expected */
|
||||||
monitor_expect_prompt (NULL, 0); /* get response */
|
monitor_expect_prompt (NULL, 0); /* get response */
|
||||||
|
|
||||||
monitor_supply_register (regno, regbuf);
|
monitor_supply_register (current_regcache, regno, regbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sometimes, it takes several commands to dump the registers */
|
/* Sometimes, it takes several commands to dump the registers */
|
||||||
|
@ -1235,13 +1236,13 @@ monitor_fetch_register (int regno)
|
||||||
case they need to compose the operation.
|
case they need to compose the operation.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
monitor_dump_reg_block (char *block_cmd)
|
monitor_dump_reg_block (struct regcache *regcache, char *block_cmd)
|
||||||
{
|
{
|
||||||
char buf[TARGET_BUF_SIZE];
|
char buf[TARGET_BUF_SIZE];
|
||||||
int resp_len;
|
int resp_len;
|
||||||
monitor_printf (block_cmd);
|
monitor_printf (block_cmd);
|
||||||
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
||||||
parse_register_dump (buf, resp_len);
|
parse_register_dump (regcache, buf, resp_len);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1250,17 +1251,17 @@ monitor_dump_reg_block (char *block_cmd)
|
||||||
/* Call the specific function if it has been provided */
|
/* Call the specific function if it has been provided */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
monitor_dump_regs (void)
|
monitor_dump_regs (struct regcache *regcache)
|
||||||
{
|
{
|
||||||
char buf[TARGET_BUF_SIZE];
|
char buf[TARGET_BUF_SIZE];
|
||||||
int resp_len;
|
int resp_len;
|
||||||
if (current_monitor->dumpregs)
|
if (current_monitor->dumpregs)
|
||||||
(*(current_monitor->dumpregs)) (); /* call supplied function */
|
(*(current_monitor->dumpregs)) (regcache); /* call supplied function */
|
||||||
else if (current_monitor->dump_registers) /* default version */
|
else if (current_monitor->dump_registers) /* default version */
|
||||||
{
|
{
|
||||||
monitor_printf (current_monitor->dump_registers);
|
monitor_printf (current_monitor->dump_registers);
|
||||||
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
||||||
parse_register_dump (buf, resp_len);
|
parse_register_dump (regcache, buf, resp_len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
internal_error (__FILE__, __LINE__, _("failed internal consistency check")); /* Need some way to read registers */
|
internal_error (__FILE__, __LINE__, _("failed internal consistency check")); /* Need some way to read registers */
|
||||||
|
@ -1283,7 +1284,7 @@ monitor_fetch_registers (int regno)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
monitor_dump_regs ();
|
monitor_dump_regs (current_regcache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,10 +100,11 @@ struct monitor_ops
|
||||||
GDB with the value of a register. */
|
GDB with the value of a register. */
|
||||||
char *dump_registers; /* Command to dump all regs at once */
|
char *dump_registers; /* Command to dump all regs at once */
|
||||||
char *register_pattern; /* Pattern that picks out register from reg dump */
|
char *register_pattern; /* Pattern that picks out register from reg dump */
|
||||||
void (*supply_register) (char *name, int namelen, char *val, int vallen);
|
void (*supply_register) (struct regcache *regcache, char *name,
|
||||||
|
int namelen, char *val, int vallen);
|
||||||
void (*load_routine) (struct serial *desc, char *file,
|
void (*load_routine) (struct serial *desc, char *file,
|
||||||
int hashmark); /* Download routine */
|
int hashmark); /* Download routine */
|
||||||
int (*dumpregs) (void); /* routine to dump all registers */
|
int (*dumpregs) (struct regcache *); /* Dump all registers */
|
||||||
int (*continue_hook) (void); /* Emit the continue command */
|
int (*continue_hook) (void); /* Emit the continue command */
|
||||||
int (*wait_filter) (char *buf, /* Maybe contains registers */
|
int (*wait_filter) (char *buf, /* Maybe contains registers */
|
||||||
int bufmax,
|
int bufmax,
|
||||||
|
@ -242,7 +243,8 @@ struct monitor_ops
|
||||||
|
|
||||||
extern void monitor_open (char *args, struct monitor_ops *ops, int from_tty);
|
extern void monitor_open (char *args, struct monitor_ops *ops, int from_tty);
|
||||||
extern void monitor_close (int quitting);
|
extern void monitor_close (int quitting);
|
||||||
extern char *monitor_supply_register (int regno, char *valstr);
|
extern char *monitor_supply_register (struct regcache *regcache,
|
||||||
|
int regno, char *valstr);
|
||||||
extern int monitor_expect (char *prompt, char *buf, int buflen);
|
extern int monitor_expect (char *prompt, char *buf, int buflen);
|
||||||
extern int monitor_expect_prompt (char *buf, int buflen);
|
extern int monitor_expect_prompt (char *buf, int buflen);
|
||||||
/* Note: The variable argument functions monitor_printf and
|
/* Note: The variable argument functions monitor_printf and
|
||||||
|
@ -255,6 +257,6 @@ extern void monitor_write (char *buf, int buflen);
|
||||||
extern int monitor_readchar (void);
|
extern int monitor_readchar (void);
|
||||||
extern char *monitor_get_dev_name (void);
|
extern char *monitor_get_dev_name (void);
|
||||||
extern void init_monitor_ops (struct target_ops *);
|
extern void init_monitor_ops (struct target_ops *);
|
||||||
extern int monitor_dump_reg_block (char *dump_cmd);
|
extern int monitor_dump_reg_block (struct regcache *regcache, char *dump_cmd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ppcbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
ppcbug_supply_register (struct regcache *regcache, char *regname,
|
||||||
|
int regnamelen, char *val, int vallen)
|
||||||
{
|
{
|
||||||
int regno = 0;
|
int regno = 0;
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ ppcbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_supply_register (regno, val);
|
monitor_supply_register (regcache, regno, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue