From 316f20603ac3da3e7037cd20fd9580d6d77d71c5 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sun, 6 May 2007 18:55:41 +0000 Subject: * 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. --- gdb/ChangeLog | 32 ++++++++++++++++++++++++++++++++ gdb/gnu-nat.c | 5 +---- gdb/go32-nat.c | 4 ++-- gdb/hpux-thread.c | 4 ++-- gdb/inf-child.c | 2 +- gdb/inftarg.c | 7 ++----- gdb/monitor.c | 2 +- gdb/nto-procfs.c | 2 +- gdb/procfs.c | 7 ++----- gdb/regcache.c | 2 +- gdb/remote-m32r-sdi.c | 2 +- gdb/remote-mips.c | 4 ++-- gdb/remote-sim.c | 4 ++-- gdb/remote.c | 6 +++--- gdb/sol-thread.c | 4 ++-- gdb/target.c | 8 ++++---- gdb/target.h | 6 +++--- gdb/win32-nat.c | 2 +- gdb/windows-nat.c | 2 +- 19 files changed, 64 insertions(+), 41 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a24b284..2420767 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,37 @@ 2007-05-06 Ulrich Weigand + * 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. + +2007-05-06 Ulrich Weigand + * target.h (struct regcache): Add forward declaration. (struct target_ops): Add REGCACHE parameter to to_fetch_registers and to_store_registers target operations. diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 4e8b82e..80ceb90 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -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 --git a/gdb/go32-nat.c b/gdb/go32-nat.c index b4b86728..a794c61 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -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 *regcache, int regno) } static void -go32_prepare_to_store (void) +go32_prepare_to_store (struct regcache *regcache) { } diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c index f65208c..71fe9f9 100644 --- a/gdb/hpux-thread.c +++ b/gdb/hpux-thread.c @@ -390,9 +390,9 @@ hpux_thread_store_registers (struct regcache *regcache, int regno) 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 --git a/gdb/inf-child.c b/gdb/inf-child.c index 00bb7fd..a30d519 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -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 --git a/gdb/inftarg.c b/gdb/inftarg.c index 3f0467f..6b9d3d7 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -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 --git a/gdb/monitor.c b/gdb/monitor.c index 00695b8..494df39 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -1367,7 +1367,7 @@ monitor_store_registers (struct regcache *regcache, int regno) debugged. */ static void -monitor_prepare_to_store (void) +monitor_prepare_to_store (struct regcache *regcache) { /* Do nothing, since we can store individual regs */ } diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 34ae3cd..57bfd87 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -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 --git a/gdb/procfs.c b/gdb/procfs.c index 788a661..606466e 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -123,7 +123,7 @@ static void procfs_files_info (struct target_ops *); 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 *regcache, int regnum) 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 --git a/gdb/regcache.c b/gdb/regcache.c index 15e4dba..c54585c 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -669,7 +669,7 @@ regcache_raw_write (struct regcache *regcache, int regnum, 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 --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 110855a..a4452de 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1014,7 +1014,7 @@ m32r_store_register (struct regcache *regcache, int regno) 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 --git a/gdb/remote-mips.c b/gdb/remote-mips.c index dcbc15c..5c2954d 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -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 *regcache, int regno) 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 --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 425d1a6..0a13713 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -91,7 +91,7 @@ static void gdbsim_resume (ptid_t ptid, int step, enum target_signal siggnal); 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_waitstatus *status) debugged. */ static void -gdbsim_prepare_to_store (void) +gdbsim_prepare_to_store (struct regcache *regcache) { /* Do nothing, since we can store individual regs */ } diff --git a/gdb/remote.c b/gdb/remote.c index 2c31c82..8e7999d 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -89,7 +89,7 @@ static void build_remote_gdbarch_data (void); 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 *regcache, int regnum) 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 --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 722e253..16e3463 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -649,9 +649,9 @@ sol_thread_store_registers (struct regcache *regcache, int regnum) 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 --git a/gdb/target.c b/gdb/target.c index fd833de..bbd97fa 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -110,7 +110,7 @@ static void debug_to_fetch_registers (struct regcache *, int); 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 regcache *regcache, int regno) } 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 --git a/gdb/target.h b/gdb/target.h index ad4e437..3382044 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -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 *, int); 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 --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 922cc28..b52edd0 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -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 */ } diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 922cc28..b52edd0 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -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 */ } -- cgit v1.1