This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Push REGCACHE into target_prepare_to_store
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Sun, 6 May 2007 20:56:33 +0200 (CEST)
- Subject: [commit] Push REGCACHE into target_prepare_to_store
Hello,
this is a small follow-on to the target_fetch/store_registers patch:
the to_prepare_to_store target_ops callback should also have a
REGCACHE argument. Fortunately, this is a lot simpler; there is
only single non-trivial prepare_to_store implementation.
Note that several to_prepare_to_store implementations still contained
a call to CHILD_PREPARE_TO_STORE; as this macro is not defined anywhere
any more, I've removed those calls as well.
Tested on s390-ibm-linux and by making sure there are no new compiler
errors building any of the modified files.
Committed to mainline.
Bye,
Ulrich
ChangeLog:
* target.h (struct target_ops): Add REGCACHE parameter to
to_prepare_to_store.
(target_prepare_to_store): Likewise.
* target.c (debug_to_prepare_to_store): Add REGCACHE parameter.
(update_current_target): Adapt prepare_to_store de_fault rule.
* regcache.c (regcache_raw_write): Pass regcache to
target_prepare_to_store.
* inftarg.c (child_prepare_to_store): Add REGCACHE parameter.
Do not call CHILD_PREPARE_TO_STORE.
* gnu-nat.c (gnu_prepare_to_store): Likewise.
* procfs.c (procfs_prepare_to_store): Likewise.
* inf-child.c (inf_child_prepare_to_store): Add REGCACHE parameter.
* go32-nat.c (go32_prepare_to_store): Likewise.
* monitor.c (monitor_prepare_to_store): Likewise.
* nto-procfs.c (procfs_prepare_to_store): Likewise.
* remote-m32r-sdi.c (m32r_prepare_to_store): Likewise.
* remote-mips.c (mips_prepare_to_store): Likewise.
* remote-sim.c (gdbsim_prepare_to_store): Likewise.
* win32-nat.c (win32_prepare_to_store): Likewise.
* remote.c (remote_prepare_to_store): Add REGCACHE parameter.
Use it instead of current_regcache.
* hpux-thread.c (hpux_thread_prepare_to_store): Add REGCACHE
parameter. Pass it on to next target.
* sol-thread.c (sol_thread_prepare_to_store): Likewise.
diff -urNp gdb-orig/gdb/gnu-nat.c gdb-head/gdb/gnu-nat.c
--- gdb-orig/gdb/gnu-nat.c 2007-05-06 16:33:43.083922000 +0200
+++ gdb-head/gdb/gnu-nat.c 2007-05-06 16:42:41.555921509 +0200
@@ -2207,11 +2207,8 @@ gnu_terminal_init_inferior (void)
that registers contains all the registers from the program being
debugged. */
static void
-gnu_prepare_to_store (void)
+gnu_prepare_to_store (struct regcache *regcache)
{
-#ifdef CHILD_PREPARE_TO_STORE
- CHILD_PREPARE_TO_STORE ();
-#endif
}
static void
diff -urNp gdb-orig/gdb/go32-nat.c gdb-head/gdb/go32-nat.c
--- gdb-orig/gdb/go32-nat.c 2007-05-06 16:33:43.127916000 +0200
+++ gdb-head/gdb/go32-nat.c 2007-05-06 16:42:41.599915169 +0200
@@ -177,7 +177,7 @@ static ptid_t go32_wait (ptid_t ptid,
static void go32_fetch_registers (struct regcache *, int regno);
static void store_register (const struct regcache *, int regno);
static void go32_store_registers (struct regcache *, int regno);
-static void go32_prepare_to_store (void);
+static void go32_prepare_to_store (struct regcache *);
static int go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
int write,
struct mem_attrib *attrib,
@@ -519,7 +519,7 @@ go32_store_registers (struct regcache *r
}
static void
-go32_prepare_to_store (void)
+go32_prepare_to_store (struct regcache *regcache)
{
}
diff -urNp gdb-orig/gdb/hpux-thread.c gdb-head/gdb/hpux-thread.c
--- gdb-orig/gdb/hpux-thread.c 2007-05-06 16:33:43.182908000 +0200
+++ gdb-head/gdb/hpux-thread.c 2007-05-06 16:42:41.640909262 +0200
@@ -390,9 +390,9 @@ hpux_thread_store_registers (struct regc
debugged. */
static void
-hpux_thread_prepare_to_store (void)
+hpux_thread_prepare_to_store (struct regcache *regcache)
{
- deprecated_child_ops.to_prepare_to_store ();
+ deprecated_child_ops.to_prepare_to_store (regcache);
}
static int
diff -urNp gdb-orig/gdb/inf-child.c gdb-head/gdb/inf-child.c
--- gdb-orig/gdb/inf-child.c 2007-05-06 16:33:43.256897000 +0200
+++ gdb-head/gdb/inf-child.c 2007-05-06 16:42:41.644908686 +0200
@@ -66,7 +66,7 @@ inf_child_post_attach (int pid)
program being debugged. */
static void
-inf_child_prepare_to_store (void)
+inf_child_prepare_to_store (struct regcache *regcache)
{
}
diff -urNp gdb-orig/gdb/inftarg.c gdb-head/gdb/inftarg.c
--- gdb-orig/gdb/inftarg.c 2007-05-05 00:37:09.000000000 +0200
+++ gdb-head/gdb/inftarg.c 2007-05-06 16:42:41.649907965 +0200
@@ -46,7 +46,7 @@ extern struct exception_event_record
extern void _initialize_inftarg (void);
-static void child_prepare_to_store (void);
+static void child_prepare_to_store (struct regcache *);
#ifndef CHILD_WAIT
static ptid_t child_wait (ptid_t, struct target_waitstatus *);
@@ -259,11 +259,8 @@ child_detach (char *args, int from_tty)
debugged. */
static void
-child_prepare_to_store (void)
+child_prepare_to_store (struct regcache *regcache)
{
-#ifdef CHILD_PREPARE_TO_STORE
- CHILD_PREPARE_TO_STORE ();
-#endif
}
/* Print status information about what we're accessing. */
diff -urNp gdb-orig/gdb/monitor.c gdb-head/gdb/monitor.c
--- gdb-orig/gdb/monitor.c 2007-05-06 16:33:43.354883000 +0200
+++ gdb-head/gdb/monitor.c 2007-05-06 16:42:41.656906957 +0200
@@ -1367,7 +1367,7 @@ monitor_store_registers (struct regcache
debugged. */
static void
-monitor_prepare_to_store (void)
+monitor_prepare_to_store (struct regcache *regcache)
{
/* Do nothing, since we can store individual regs */
}
diff -urNp gdb-orig/gdb/nto-procfs.c gdb-head/gdb/nto-procfs.c
--- gdb-orig/gdb/nto-procfs.c 2007-05-06 16:33:43.360882000 +0200
+++ gdb-head/gdb/nto-procfs.c 2007-05-06 16:42:41.662906092 +0200
@@ -1109,7 +1109,7 @@ procfs_kill_inferior (void)
/* Store register REGNO, or all registers if REGNO == -1, from the contents
of REGISTERS. */
static void
-procfs_prepare_to_store (void)
+procfs_prepare_to_store (struct regcache *regcache)
{
}
diff -urNp gdb-orig/gdb/procfs.c gdb-head/gdb/procfs.c
--- gdb-orig/gdb/procfs.c 2007-05-06 16:33:43.390878000 +0200
+++ gdb-head/gdb/procfs.c 2007-05-06 16:42:41.676904075 +0200
@@ -123,7 +123,7 @@ static void procfs_files_info (struct ta
static void procfs_fetch_registers (struct regcache *, int);
static void procfs_store_registers (struct regcache *, int);
static void procfs_notice_signals (ptid_t);
-static void procfs_prepare_to_store (void);
+static void procfs_prepare_to_store (struct regcache *);
static void procfs_kill_inferior (void);
static void procfs_mourn_inferior (void);
static void procfs_create_inferior (char *, char *, char **, int);
@@ -3732,11 +3732,8 @@ procfs_fetch_registers (struct regcache
from the program being debugged. */
static void
-procfs_prepare_to_store (void)
+procfs_prepare_to_store (struct regcache *regcache)
{
-#ifdef CHILD_PREPARE_TO_STORE
- CHILD_PREPARE_TO_STORE ();
-#endif
}
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
diff -urNp gdb-orig/gdb/regcache.c gdb-head/gdb/regcache.c
--- gdb-orig/gdb/regcache.c 2007-05-06 16:33:43.438871000 +0200
+++ gdb-head/gdb/regcache.c 2007-05-06 16:59:24.360649127 +0200
@@ -669,7 +669,7 @@ regcache_raw_write (struct regcache *reg
regcache->descr->sizeof_register[regnum]) == 0))
return;
- target_prepare_to_store ();
+ target_prepare_to_store (regcache);
memcpy (register_buffer (regcache, regnum), buf,
regcache->descr->sizeof_register[regnum]);
regcache->register_valid_p[regnum] = 1;
diff -urNp gdb-orig/gdb/remote.c gdb-head/gdb/remote.c
--- gdb-orig/gdb/remote.c 2007-05-06 16:33:43.452869000 +0200
+++ gdb-head/gdb/remote.c 2007-05-06 16:47:19.821102565 +0200
@@ -89,7 +89,7 @@ static void build_remote_gdbarch_data (v
static void remote_files_info (struct target_ops *ignore);
-static void remote_prepare_to_store (void);
+static void remote_prepare_to_store (struct regcache *regcache);
static void remote_fetch_registers (struct regcache *regcache, int regno);
@@ -3730,7 +3730,7 @@ remote_fetch_registers (struct regcache
first. */
static void
-remote_prepare_to_store (void)
+remote_prepare_to_store (struct regcache *regcache)
{
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
@@ -3744,7 +3744,7 @@ remote_prepare_to_store (void)
/* Make sure all the necessary registers are cached. */
for (i = 0; i < NUM_REGS; i++)
if (rsa->regs[i].in_g_packet)
- regcache_raw_read (current_regcache, rsa->regs[i].regnum, buf);
+ regcache_raw_read (regcache, rsa->regs[i].regnum, buf);
break;
case PACKET_ENABLE:
break;
diff -urNp gdb-orig/gdb/remote-m32r-sdi.c gdb-head/gdb/remote-m32r-sdi.c
--- gdb-orig/gdb/remote-m32r-sdi.c 2007-05-06 16:33:43.494863000 +0200
+++ gdb-head/gdb/remote-m32r-sdi.c 2007-05-06 16:42:41.783021872 +0200
@@ -1014,7 +1014,7 @@ m32r_store_register (struct regcache *re
debugged. */
static void
-m32r_prepare_to_store (void)
+m32r_prepare_to_store (struct regcache *regcache)
{
/* Do nothing, since we can store individual regs */
if (remote_debug)
diff -urNp gdb-orig/gdb/remote-mips.c gdb-head/gdb/remote-mips.c
--- gdb-orig/gdb/remote-mips.c 2007-05-06 16:33:43.504862000 +0200
+++ gdb-head/gdb/remote-mips.c 2007-05-06 16:42:41.792020575 +0200
@@ -98,7 +98,7 @@ static int mips_map_regno (int regno);
static void mips_fetch_registers (struct regcache *regcache, int regno);
-static void mips_prepare_to_store (void);
+static void mips_prepare_to_store (struct regcache *regcache);
static void mips_store_registers (struct regcache *regcache, int regno);
@@ -1946,7 +1946,7 @@ mips_fetch_registers (struct regcache *r
registers, so this function doesn't have to do anything. */
static void
-mips_prepare_to_store (void)
+mips_prepare_to_store (struct regcache *regcache)
{
}
diff -urNp gdb-orig/gdb/remote-sim.c gdb-head/gdb/remote-sim.c
--- gdb-orig/gdb/remote-sim.c 2007-05-06 16:33:43.545856000 +0200
+++ gdb-head/gdb/remote-sim.c 2007-05-06 16:47:53.175347337 +0200
@@ -91,7 +91,7 @@ static void gdbsim_resume (ptid_t ptid,
static ptid_t gdbsim_wait (ptid_t ptid, struct target_waitstatus *status);
-static void gdbsim_prepare_to_store (void);
+static void gdbsim_prepare_to_store (struct regcache *regcache);
static void gdbsim_files_info (struct target_ops *target);
@@ -734,7 +734,7 @@ gdbsim_wait (ptid_t ptid, struct target_
debugged. */
static void
-gdbsim_prepare_to_store (void)
+gdbsim_prepare_to_store (struct regcache *regcache)
{
/* Do nothing, since we can store individual regs */
}
diff -urNp gdb-orig/gdb/sol-thread.c gdb-head/gdb/sol-thread.c
--- gdb-orig/gdb/sol-thread.c 2007-05-06 16:33:43.578851000 +0200
+++ gdb-head/gdb/sol-thread.c 2007-05-06 16:42:41.852011930 +0200
@@ -649,9 +649,9 @@ sol_thread_store_registers (struct regca
program being debugged. */
static void
-sol_thread_prepare_to_store (void)
+sol_thread_prepare_to_store (struct regcache *regcache)
{
- procfs_ops.to_prepare_to_store ();
+ procfs_ops.to_prepare_to_store (regcache);
}
/* Transfer LEN bytes between GDB address MYADDR and target address
diff -urNp gdb-orig/gdb/target.c gdb-head/gdb/target.c
--- gdb-orig/gdb/target.c 2007-05-06 16:33:43.596848000 +0200
+++ gdb-head/gdb/target.c 2007-05-06 16:42:41.860010778 +0200
@@ -110,7 +110,7 @@ static void debug_to_fetch_registers (st
static void debug_to_store_registers (struct regcache *, int);
-static void debug_to_prepare_to_store (void);
+static void debug_to_prepare_to_store (struct regcache *);
static void debug_to_files_info (struct target_ops *);
@@ -509,7 +509,7 @@ update_current_target (void)
(void (*) (struct regcache *, int))
noprocess);
de_fault (to_prepare_to_store,
- (void (*) (void))
+ (void (*) (struct regcache *))
noprocess);
de_fault (deprecated_xfer_memory,
(int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *))
@@ -2195,9 +2195,9 @@ debug_to_store_registers (struct regcach
}
static void
-debug_to_prepare_to_store (void)
+debug_to_prepare_to_store (struct regcache *regcache)
{
- debug_target.to_prepare_to_store ();
+ debug_target.to_prepare_to_store (regcache);
fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
}
diff -urNp gdb-orig/gdb/target.h gdb-head/gdb/target.h
--- gdb-orig/gdb/target.h 2007-05-06 16:33:43.603847000 +0200
+++ gdb-head/gdb/target.h 2007-05-06 16:42:41.868009625 +0200
@@ -326,7 +326,7 @@ struct target_ops
ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
void (*to_fetch_registers) (struct regcache *, int);
void (*to_store_registers) (struct regcache *, int);
- void (*to_prepare_to_store) (void);
+ void (*to_prepare_to_store) (struct regcache *);
/* Transfer LEN bytes of memory between GDB address MYADDR and
target address MEMADDR. If WRITE, transfer them to the target, else
@@ -606,8 +606,8 @@ extern void target_disconnect (char *, i
that REGISTERS contains all the registers from the program being
debugged. */
-#define target_prepare_to_store() \
- (*current_target.to_prepare_to_store) ()
+#define target_prepare_to_store(regcache) \
+ (*current_target.to_prepare_to_store) (regcache)
extern DCACHE *target_dcache;
diff -urNp gdb-orig/gdb/win32-nat.c gdb-head/gdb/win32-nat.c
--- gdb-orig/gdb/win32-nat.c 2007-05-06 16:33:43.615846000 +0200
+++ gdb-head/gdb/win32-nat.c 2007-05-06 16:42:41.876008472 +0200
@@ -2039,7 +2039,7 @@ win32_kill_inferior (void)
}
static void
-win32_prepare_to_store (void)
+win32_prepare_to_store (struct regcache *regcache)
{
/* Do nothing, since we can store individual regs */
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com