aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-05-06 14:31:30 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-05-06 14:31:30 +0000
commitc410a84ca9f4c590dcc494a77d421f5b7019b973 (patch)
tree903b73e81f4805ddd07f4144b846253c131c6423
parent468e3d51268b65763ec2df63146968944c8cc607 (diff)
downloadgdb-c410a84ca9f4c590dcc494a77d421f5b7019b973.zip
gdb-c410a84ca9f4c590dcc494a77d421f5b7019b973.tar.gz
gdb-c410a84ca9f4c590dcc494a77d421f5b7019b973.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog27
-rw-r--r--gdb/dbug-rom.c5
-rw-r--r--gdb/dink32-rom.c5
-rw-r--r--gdb/m32r-rom.c31
-rw-r--r--gdb/monitor.c29
-rw-r--r--gdb/monitor.h10
-rw-r--r--gdb/ppcbug-rom.c5
7 files changed, 73 insertions, 39 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 91177cd..dd1fd7f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,32 @@
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):
Add REGCACHE parameter. Use it instead of current_regcache.
(i386nto_supply_regset): Add REGCACHE parameter, pass it to
diff --git a/gdb/dbug-rom.c b/gdb/dbug-rom.c
index a299088..c4f0ef0 100644
--- a/gdb/dbug-rom.c
+++ b/gdb/dbug-rom.c
@@ -38,7 +38,8 @@
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;
@@ -71,7 +72,7 @@ dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
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
diff --git a/gdb/dink32-rom.c b/gdb/dink32-rom.c
index 26609c6..074d761 100644
--- a/gdb/dink32-rom.c
+++ b/gdb/dink32-rom.c
@@ -31,7 +31,8 @@
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;
@@ -93,7 +94,7 @@ dink32_supply_register (char *regname, int regnamelen, char *val, int vallen)
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
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index f16deeb..4e690c0 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -210,7 +210,8 @@ static char *m32r_regnames[] =
};
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]);
@@ -224,14 +225,14 @@ m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
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);
@@ -239,45 +240,45 @@ m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
#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);
}
}
}
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 0ed6f3d..6266ab0 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -63,7 +63,7 @@ static struct target_ops *targ_ops;
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);
@@ -848,7 +848,7 @@ monitor_detach (char *args, int from_tty)
/* 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];
@@ -887,7 +887,7 @@ monitor_supply_register (int regno, char *valstr)
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;
}
@@ -926,7 +926,7 @@ monitor_resume (ptid_t ptid, int step, enum target_signal sig)
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)
@@ -948,7 +948,8 @@ parse_register_dump (char *buf, int len)
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];
@@ -1108,10 +1109,10 @@ monitor_wait (ptid_t ptid, struct target_waitstatus *status)
}
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;
@@ -1227,7 +1228,7 @@ monitor_fetch_register (int regno)
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 */
@@ -1235,13 +1236,13 @@ monitor_fetch_register (int regno)
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;
}
@@ -1250,17 +1251,17 @@ monitor_dump_reg_block (char *block_cmd)
/* 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 */
@@ -1283,7 +1284,7 @@ monitor_fetch_registers (int regno)
}
else
{
- monitor_dump_regs ();
+ monitor_dump_regs (current_regcache);
}
}
diff --git a/gdb/monitor.h b/gdb/monitor.h
index 2a5bcb7..b3d514f 100644
--- a/gdb/monitor.h
+++ b/gdb/monitor.h
@@ -100,10 +100,11 @@ struct monitor_ops
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,
@@ -242,7 +243,8 @@ struct monitor_ops
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
@@ -255,6 +257,6 @@ extern void monitor_write (char *buf, int buflen);
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
diff --git a/gdb/ppcbug-rom.c b/gdb/ppcbug-rom.c
index c9b3e71..3d8b599 100644
--- a/gdb/ppcbug-rom.c
+++ b/gdb/ppcbug-rom.c
@@ -30,7 +30,8 @@
#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;
@@ -92,7 +93,7 @@ ppcbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
return;
}
- monitor_supply_register (regno, val);
+ monitor_supply_register (regcache, regno, val);
}
/*