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>
+
+ * 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>
* i386-nto-tdep.c (i386nto_supply_gregset, i386nto_supply_fpregset):
static void dbug_open (char *args, int from_tty);
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;
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
static void dink32_open (char *args, int from_tty);
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;
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
};
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 num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
if (regno == ACCL_REGNUM)
{ /* 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 */
if (val != NULL)
- monitor_supply_register (ACCL_REGNUM, val + 1);
+ monitor_supply_register (regcache, ACCL_REGNUM, val + 1);
}
else
{
- monitor_supply_register (regno, val);
+ monitor_supply_register (regcache, regno, val);
if (regno == PSW_REGNUM)
{
unsigned long psw = strtoul (val, NULL, 16);
#ifdef SM_REGNUM
/* Stack mode bit */
- monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
+ monitor_supply_register (regcache, SM_REGNUM, (psw & 0x80) ? one : zero);
#endif
#ifdef BSM_REGNUM
/* Backup stack mode bit */
- monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
+ monitor_supply_register (regcache, BSM_REGNUM, (psw & 0x8000) ? one : zero);
#endif
#ifdef IE_REGNUM
/* Interrupt enable bit */
- monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
+ monitor_supply_register (regcache, IE_REGNUM, (psw & 0x40) ? one : zero);
#endif
#ifdef BIE_REGNUM
/* Backup interrupt enable bit */
- monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
+ monitor_supply_register (regcache, BIE_REGNUM, (psw & 0x4000) ? one : zero);
#endif
#ifdef COND_REGNUM
/* Condition bit (carry etc.) */
- monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
+ monitor_supply_register (regcache, COND_REGNUM, (psw & 0x1) ? one : zero);
#endif
#ifdef CBR_REGNUM
- monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
+ monitor_supply_register (regcache, CBR_REGNUM, (psw & 0x1) ? one : zero);
#endif
#ifdef BPC_REGNUM
- monitor_supply_register (BPC_REGNUM, zero); /* KLUDGE: (???????) */
+ monitor_supply_register (regcache, BPC_REGNUM, zero); /* KLUDGE: (???????) */
#endif
#ifdef BCARRY_REGNUM
- monitor_supply_register (BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
+ monitor_supply_register (regcache, BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
#endif
}
if (regno == SPI_REGNUM || regno == SPU_REGNUM)
{ /* special handling for stack pointer (spu or spi) */
ULONGEST stackmode, psw;
- regcache_cooked_read_unsigned (current_regcache, PSW_REGNUM, &psw);
+ regcache_cooked_read_unsigned (regcache, PSW_REGNUM, &psw);
stackmode = psw & 0x80;
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 */
- monitor_supply_register (SP_REGNUM, val);
+ monitor_supply_register (regcache, SP_REGNUM, val);
}
}
}
static void monitor_interrupt_query (void);
static void monitor_interrupt_twice (int);
static void monitor_stop (void);
-static void monitor_dump_regs (void);
+static void monitor_dump_regs (struct regcache *regcache);
#if 0
static int from_hex (int a);
/* Convert VALSTR into the target byte-ordered value of REGNO and store it. */
char *
-monitor_supply_register (int regno, char *valstr)
+monitor_supply_register (struct regcache *regcache, int regno, char *valstr)
{
ULONGEST val;
unsigned char regbuf[MAX_REGISTER_SIZE];
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;
}
string which are passed down to monitor specific code. */
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");
while (1)
vallen = register_strings.end[2] - 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];
len -= register_strings.end[0];
}
if (current_monitor->register_pattern)
- parse_register_dump (buf, resp_len);
+ parse_register_dump (current_regcache, buf, resp_len);
#else
monitor_debug ("Wait fetching registers after stop\n");
- monitor_dump_regs ();
+ monitor_dump_regs (current_regcache);
#endif
status->kind = TARGET_WAITKIND_STOPPED;
current_monitor->getreg.term_cmd) /* ack expected */
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 */
case they need to compose the operation.
*/
int
-monitor_dump_reg_block (char *block_cmd)
+monitor_dump_reg_block (struct regcache *regcache, char *block_cmd)
{
char buf[TARGET_BUF_SIZE];
int resp_len;
monitor_printf (block_cmd);
resp_len = monitor_expect_prompt (buf, sizeof (buf));
- parse_register_dump (buf, resp_len);
+ parse_register_dump (regcache, buf, resp_len);
return 1;
}
/* Call the specific function if it has been provided */
static void
-monitor_dump_regs (void)
+monitor_dump_regs (struct regcache *regcache)
{
char buf[TARGET_BUF_SIZE];
int resp_len;
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 */
{
monitor_printf (current_monitor->dump_registers);
resp_len = monitor_expect_prompt (buf, sizeof (buf));
- parse_register_dump (buf, resp_len);
+ parse_register_dump (regcache, buf, resp_len);
}
else
internal_error (__FILE__, __LINE__, _("failed internal consistency check")); /* Need some way to read registers */
}
else
{
- monitor_dump_regs ();
+ monitor_dump_regs (current_regcache);
}
}
GDB with the value of a register. */
char *dump_registers; /* Command to dump all regs at once */
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,
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 (*wait_filter) (char *buf, /* Maybe contains registers */
int bufmax,
extern void monitor_open (char *args, struct monitor_ops *ops, int from_tty);
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_prompt (char *buf, int buflen);
/* Note: The variable argument functions monitor_printf and
extern int monitor_readchar (void);
extern char *monitor_get_dev_name (void);
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
#include "regcache.h"
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;
return;
}
- monitor_supply_register (regno, val);
+ monitor_supply_register (regcache, regno, val);
}
/*