This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH v9 14/29] target: add ops parameter to to_prepare_to_store method
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Tom Tromey <tromey at redhat dot com>, Pedro Alves <palves at redhat dot com>
- Cc: "jan dot kratochvil at redhat dot com" <jan dot kratochvil at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 20 Dec 2013 13:06:34 +0000
- Subject: RE: [PATCH v9 14/29] target: add ops parameter to to_prepare_to_store method
- Authentication-results: sourceware.org; auth=none
- References: <1387471499-29444-1-git-send-email-markus dot t dot metzger at intel dot com> <1387471499-29444-15-git-send-email-markus dot t dot metzger at intel dot com> <52B33B4E dot 8070409 at redhat dot com> <87ioukk0io dot fsf at fleche dot redhat dot com>
> -----Original Message-----
> From: Tom Tromey [mailto:tromey@redhat.com]
> Sent: Thursday, December 19, 2013 10:13 PM
> Pedro> There are more sites that need updating. E.g., go32-nat.c,
> Pedro> nto-procfs.c, windows-nat.c, possibly others. Try grepping
> Pedro> for to_prepare_to_store.
> [...]
> Pedro> There should be a noprocess() call after the loop here.
>
> You can try this. I don't know whether it is complete but it's
> certainly more complete.
>
> Tom
Thanks, Tom. I'll drop my patch and take yours.
Do you plan to commit this soon?
Regards,
Markus.
> commit 1f51251857caf3522c45701ea2c47b4d43a4f60d
> Author: Tom Tromey <tromey@redhat.com>
> Date: Tue Dec 17 21:28:22 2013 -0700
>
> Add target_ops argument to to_prepare_to_store
>
> 2013-12-17 Tom Tromey <tromey@redhat.com>
>
> * windows-nat.c (windows_prepare_to_store): Add 'self' argument.
> * target.h (struct target_ops) <to_prepare_to_store>: Add
> argument.
> (target_prepare_to_store): Add argument.
> * target.c (debug_to_prepare_to_store): Add argument.
> (update_current_target): Update.
> * remote.c (remote_prepare_to_store): Add 'self' argument.
> * remote-sim.c (gdbsim_prepare_to_store): Add 'self' argument.
> * remote-mips.c (mips_prepare_to_store): Add 'self' argument.
> * remote-m32r-sdi.c (m32r_prepare_to_store): Add 'self' argument.
> * record-full.c (record_full_core_prepare_to_store): Add 'self'
> argument.
> * ravenscar-thread.c (ravenscar_prepare_to_store): Add argument.
> * nto-procfs.c (procfs_prepare_to_store): Add 'self' argument.
> * monitor.c (monitor_prepare_to_store): Add 'self' argument.
> * inf-child.c (inf_child_prepare_to_store): Add 'self' argument.
> * go32-nat.c (go32_prepare_to_store): Add 'self' argument.
>
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 9cbb85f..fd7605d 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,25 @@
> 2013-12-17 Tom Tromey <tromey@redhat.com>
>
> + * windows-nat.c (windows_prepare_to_store): Add 'self' argument.
> + * target.h (struct target_ops) <to_prepare_to_store>: Add
> + argument.
> + (target_prepare_to_store): Add argument.
> + * target.c (debug_to_prepare_to_store): Add argument.
> + (update_current_target): Update.
> + * remote.c (remote_prepare_to_store): Add 'self' argument.
> + * remote-sim.c (gdbsim_prepare_to_store): Add 'self' argument.
> + * remote-mips.c (mips_prepare_to_store): Add 'self' argument.
> + * remote-m32r-sdi.c (m32r_prepare_to_store): Add 'self' argument.
> + * record-full.c (record_full_core_prepare_to_store): Add 'self'
> + argument.
> + * ravenscar-thread.c (ravenscar_prepare_to_store): Add argument.
> + * nto-procfs.c (procfs_prepare_to_store): Add 'self' argument.
> + * monitor.c (monitor_prepare_to_store): Add 'self' argument.
> + * inf-child.c (inf_child_prepare_to_store): Add 'self' argument.
> + * go32-nat.c (go32_prepare_to_store): Add 'self' argument.
> +
> +2013-12-17 Tom Tromey <tromey@redhat.com>
> +
> * target.h (struct target_ops) <to_post_attach>: Add argument.
> (target_post_attach): Add argument.
> * target.c (debug_to_post_attach): Add argument.
> diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
> index caf595c..ef6ceef 100644
> --- a/gdb/go32-nat.c
> +++ b/gdb/go32-nat.c
> @@ -246,7 +246,8 @@ static void go32_fetch_registers (struct target_ops
> *ops,
> static void store_register (const struct regcache *, int regno);
> static void go32_store_registers (struct target_ops *ops,
> struct regcache *, int regno);
> -static void go32_prepare_to_store (struct regcache *);
> +static void go32_prepare_to_store (struct target_ops *self,
> + struct regcache *);
> static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
> int len,
> int write,
> struct mem_attrib *attrib,
> @@ -598,7 +599,7 @@ go32_store_registers (struct target_ops *ops,
> }
>
> static void
> -go32_prepare_to_store (struct regcache *regcache)
> +go32_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> }
>
> diff --git a/gdb/inf-child.c b/gdb/inf-child.c
> index 77853e8..de36417 100644
> --- a/gdb/inf-child.c
> +++ b/gdb/inf-child.c
> @@ -100,7 +100,8 @@ inf_child_post_attach (struct target_ops *self, int pid)
> program being debugged. */
>
> static void
> -inf_child_prepare_to_store (struct regcache *regcache)
> +inf_child_prepare_to_store (struct target_ops *self,
> + struct regcache *regcache)
> {
> }
>
> diff --git a/gdb/monitor.c b/gdb/monitor.c
> index 70064ba..4292f47 100644
> --- a/gdb/monitor.c
> +++ b/gdb/monitor.c
> @@ -1427,7 +1427,7 @@ monitor_store_registers (struct target_ops *ops,
> debugged. */
>
> static void
> -monitor_prepare_to_store (struct regcache *regcache)
> +monitor_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> /* Do nothing, since we can store individual regs. */
> }
> diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
> index bbc071f..308b398 100644
> --- a/gdb/nto-procfs.c
> +++ b/gdb/nto-procfs.c
> @@ -1231,7 +1231,7 @@ procfs_kill_inferior (struct target_ops *ops)
> /* Store register REGNO, or all registers if REGNO == -1, from the contents
> of REGISTERS. */
> static void
> -procfs_prepare_to_store (struct regcache *regcache)
> +procfs_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> }
>
> diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
> index 9ef265d..0d60277 100644
> --- a/gdb/ravenscar-thread.c
> +++ b/gdb/ravenscar-thread.c
> @@ -62,7 +62,8 @@ static void ravenscar_fetch_registers (struct target_ops
> *ops,
> struct regcache *regcache, int regnum);
> static void ravenscar_store_registers (struct target_ops *ops,
> struct regcache *regcache, int regnum);
> -static void ravenscar_prepare_to_store (struct regcache *regcache);
> +static void ravenscar_prepare_to_store (struct target_ops *self,
> + struct regcache *regcache);
> static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
> enum gdb_signal siggnal);
> static void ravenscar_mourn_inferior (struct target_ops *ops);
> @@ -303,14 +304,15 @@ ravenscar_store_registers (struct target_ops *ops,
> }
>
> static void
> -ravenscar_prepare_to_store (struct regcache *regcache)
> +ravenscar_prepare_to_store (struct target_ops *self,
> + struct regcache *regcache)
> {
> struct target_ops *beneath = find_target_beneath (&ravenscar_ops);
>
> if (!ravenscar_runtime_initialized ()
> || ptid_equal (inferior_ptid, base_magic_null_ptid)
> || ptid_equal (inferior_ptid, ravenscar_running_thread ()))
> - beneath->to_prepare_to_store (regcache);
> + beneath->to_prepare_to_store (beneath, regcache);
> else
> {
> struct gdbarch *gdbarch = get_regcache_arch (regcache);
> diff --git a/gdb/record-full.c b/gdb/record-full.c
> index dedb264..9e8ac1e 100644
> --- a/gdb/record-full.c
> +++ b/gdb/record-full.c
> @@ -1969,7 +1969,8 @@ record_full_core_fetch_registers (struct
> target_ops *ops,
> /* "to_prepare_to_store" method for prec over corefile. */
>
> static void
> -record_full_core_prepare_to_store (struct regcache *regcache)
> +record_full_core_prepare_to_store (struct target_ops *self,
> + struct regcache *regcache)
> {
> }
>
> diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
> index 43f3772..a57e76f 100644
> --- a/gdb/remote-m32r-sdi.c
> +++ b/gdb/remote-m32r-sdi.c
> @@ -1013,7 +1013,7 @@ m32r_store_register (struct target_ops *ops,
> debugged. */
>
> static void
> -m32r_prepare_to_store (struct regcache *regcache)
> +m32r_prepare_to_store (struct target_ops *self, 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 9ba72bf..cefbda7 100644
> --- a/gdb/remote-mips.c
> +++ b/gdb/remote-mips.c
> @@ -90,7 +90,8 @@ static int mips_map_regno (struct gdbarch *, int);
>
> static void mips_set_register (int regno, ULONGEST value);
>
> -static void mips_prepare_to_store (struct regcache *regcache);
> +static void mips_prepare_to_store (struct target_ops *self,
> + struct regcache *regcache);
>
> static int mips_fetch_word (CORE_ADDR addr, unsigned int *valp);
>
> @@ -2064,7 +2065,7 @@ mips_fetch_registers (struct target_ops *ops,
> registers, so this function doesn't have to do anything. */
>
> static void
> -mips_prepare_to_store (struct regcache *regcache)
> +mips_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> }
>
> diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
> index 59ea2a1..9f1e5eb 100644
> --- a/gdb/remote-sim.c
> +++ b/gdb/remote-sim.c
> @@ -81,7 +81,8 @@ static void gdbsim_close (struct target_ops *self);
> static void gdbsim_detach (struct target_ops *ops, const char *args,
> int from_tty);
>
> -static void gdbsim_prepare_to_store (struct regcache *regcache);
> +static void gdbsim_prepare_to_store (struct target_ops *self,
> + struct regcache *regcache);
>
> static void gdbsim_files_info (struct target_ops *target);
>
> @@ -1052,7 +1053,7 @@ gdbsim_wait (struct target_ops *ops,
> debugged. */
>
> static void
> -gdbsim_prepare_to_store (struct regcache *regcache)
> +gdbsim_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> /* Do nothing, since we can store individual regs. */
> }
> diff --git a/gdb/remote.c b/gdb/remote.c
> index c9ce3fb..aaed11c 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -98,7 +98,8 @@ static void async_handle_remote_sigint_twice (int);
>
> static void remote_files_info (struct target_ops *ignore);
>
> -static void remote_prepare_to_store (struct regcache *regcache);
> +static void remote_prepare_to_store (struct target_ops *self,
> + struct regcache *regcache);
>
> static void remote_open (char *name, int from_tty);
>
> @@ -6415,7 +6416,7 @@ remote_fetch_registers (struct target_ops *ops,
> first. */
>
> static void
> -remote_prepare_to_store (struct regcache *regcache)
> +remote_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> struct remote_arch_state *rsa = get_remote_arch_state ();
> int i;
> diff --git a/gdb/target.c b/gdb/target.c
> index db665a4..69f8c52 100644
> --- a/gdb/target.c
> +++ b/gdb/target.c
> @@ -91,7 +91,8 @@ static struct target_ops debug_target;
>
> static void debug_to_open (char *, int);
>
> -static void debug_to_prepare_to_store (struct regcache *);
> +static void debug_to_prepare_to_store (struct target_ops *self,
> + struct regcache *);
>
> static void debug_to_files_info (struct target_ops *);
>
> @@ -719,7 +720,7 @@ update_current_target (void)
> (void (*) (struct target_ops *, int))
> target_ignore);
> de_fault (to_prepare_to_store,
> - (void (*) (struct regcache *))
> + (void (*) (struct target_ops *, struct regcache *))
> noprocess);
> de_fault (deprecated_xfer_memory,
> (int (*) (CORE_ADDR, gdb_byte *, int, int,
> @@ -4383,9 +4384,9 @@ target_call_history_range (ULONGEST begin,
> ULONGEST end, int flags)
> }
>
> static void
> -debug_to_prepare_to_store (struct regcache *regcache)
> +debug_to_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> - debug_target.to_prepare_to_store (regcache);
> + debug_target.to_prepare_to_store (&debug_target, regcache);
>
> fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
> }
> diff --git a/gdb/target.h b/gdb/target.h
> index a1b1e94..583fcd5 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -388,7 +388,7 @@ struct target_ops
> void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
> void (*to_store_registers) (struct target_ops *, struct regcache *, int)
> TARGET_DEFAULT (noprocess ());
> - void (*to_prepare_to_store) (struct regcache *);
> + void (*to_prepare_to_store) (struct target_ops *, struct regcache *);
>
> /* Transfer LEN bytes of memory between GDB address MYADDR and
> target address MEMADDR. If WRITE, transfer them to the target, else
> @@ -1031,7 +1031,7 @@ extern void target_store_registers (struct regcache
> *regcache, int regs);
> debugged. */
>
> #define target_prepare_to_store(regcache) \
> - (*current_target.to_prepare_to_store) (regcache)
> + (*current_target.to_prepare_to_store) (¤t_target, regcache)
>
> /* Determine current address space of thread PTID. */
>
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index e2b3a57..3942f6f 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -2459,7 +2459,7 @@ windows_kill_inferior (struct target_ops *ops)
> }
>
> static void
> -windows_prepare_to_store (struct regcache *regcache)
> +windows_prepare_to_store (struct target_ops *self, struct regcache
> *regcache)
> {
> /* Do nothing, since we can store individual regs. */
> }
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052