From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3274 invoked by alias); 18 Aug 2013 19:07:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3265 invoked by uid 89); 18 Aug 2013 19:07:26 -0000 X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 18 Aug 2013 19:07:25 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7IJ7NtS001321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 18 Aug 2013 15:07:23 -0400 Received: from host2.jankratochvil.net (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7IJ7Gf4008453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 18 Aug 2013 15:07:19 -0400 Date: Sun, 18 Aug 2013 19:07:00 -0000 From: Jan Kratochvil To: Markus Metzger Cc: gdb-patches@sourceware.org Subject: Re: [patch v4 10/24] target: add ops parameter to to_prepare_to_store method Message-ID: <20130818190716.GH24153@host2.jankratochvil.net> References: <1372842874-28951-1-git-send-email-markus.t.metzger@intel.com> <1372842874-28951-11-git-send-email-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1372842874-28951-11-git-send-email-markus.t.metzger@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-08/txt/msg00464.txt.bz2 On Wed, 03 Jul 2013 11:14:20 +0200, Markus Metzger wrote: > To allow forwarding the prepare_to_store request to the target beneath, > add a target_ops * parameter. > > 2013-07-03 Markus Metzger > > * target.h (target_ops) : Add parameter. > (target_prepare_to_store): Remove macro. New function. > * target.c (update_current_target): Do not inherit/default > prepare_to_store. > (target_prepare_to_store): New. > (debug_to_prepare_to_store): Remove. > * remote.c (remote_prepare_to_store): Add parameter. > * remote-mips.c (mips_prepare_to_store): Add parameter. > * remote-m32r-sdi.c (m32r_prepare_to_store): Add parameter. > * ravenscar-thread.c (ravenscar_prepare_to_store): Add > parameter. > * monitor.c (monitor_prepare_to_store): Add parameter. > * inf-child.c (inf_child_prepare_to_store): Add parameter. > > > --- > gdb/inf-child.c | 2 +- > gdb/monitor.c | 2 +- > gdb/ravenscar-thread.c | 7 ++++--- > gdb/record-full.c | 3 ++- > gdb/remote-m32r-sdi.c | 2 +- > gdb/remote-mips.c | 5 +++-- > gdb/remote.c | 5 +++-- > gdb/target.c | 36 +++++++++++++++++++++--------------- > gdb/target.h | 5 ++--- > 9 files changed, 38 insertions(+), 29 deletions(-) > > diff --git a/gdb/inf-child.c b/gdb/inf-child.c > index f5992bb..3be4315 100644 > --- a/gdb/inf-child.c > +++ b/gdb/inf-child.c > @@ -100,7 +100,7 @@ inf_child_post_attach (int pid) > program being debugged. */ > > static void > -inf_child_prepare_to_store (struct regcache *regcache) > +inf_child_prepare_to_store (struct target_ops *ops, struct regcache *regcache) > { > } > > diff --git a/gdb/monitor.c b/gdb/monitor.c > index beca4e4..8b1059c 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 *ops, struct regcache *regcache) > { > /* Do nothing, since we can store individual regs. */ > } > diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c > index 0a3100d..adcd3a2 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 *ops, > + 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,14 @@ ravenscar_store_registers (struct target_ops *ops, > } > > static void > -ravenscar_prepare_to_store (struct regcache *regcache) > +ravenscar_prepare_to_store (struct target_ops *ops, 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 3a8d326..058da8a 100644 > --- a/gdb/record-full.c > +++ b/gdb/record-full.c > @@ -2148,7 +2148,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 *ops, > + struct regcache *regcache) > { > } > > diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c > index 2f910e6..1955ec1 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 *target, 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 1619622..5aa57f1 100644 > --- a/gdb/remote-mips.c > +++ b/gdb/remote-mips.c > @@ -92,7 +92,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 *ops, > + struct regcache *regcache); > > static int mips_fetch_word (CORE_ADDR addr, unsigned int *valp); > > @@ -2069,7 +2070,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 *ops, struct regcache *regcache) > { > } > > diff --git a/gdb/remote.c b/gdb/remote.c > index 1d6ac90..b352ca6 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -101,7 +101,8 @@ static void async_remote_interrupt_twice (gdb_client_data); > > 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 *ops, > + struct regcache *regcache); > > static void remote_open (char *name, int from_tty); > > @@ -6348,7 +6349,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 *ops, 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 920f916..ecffc9c 100644 > --- a/gdb/target.c > +++ b/gdb/target.c > @@ -96,8 +96,6 @@ 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_files_info (struct target_ops *); > > static int debug_to_insert_breakpoint (struct gdbarch *, > @@ -623,7 +621,7 @@ update_current_target (void) > /* Do not inherit to_wait. */ > /* Do not inherit to_fetch_registers. */ > /* Do not inherit to_store_registers. */ > - INHERIT (to_prepare_to_store, t); > + /* Do not inherit to_prepare_to_store. */ > INHERIT (deprecated_xfer_memory, t); > INHERIT (to_files_info, t); > INHERIT (to_insert_breakpoint, t); > @@ -757,9 +755,6 @@ update_current_target (void) > de_fault (to_post_attach, > (void (*) (int)) > target_ignore); > - de_fault (to_prepare_to_store, > - (void (*) (struct regcache *)) > - noprocess); > de_fault (deprecated_xfer_memory, > (int (*) (CORE_ADDR, gdb_byte *, int, int, > struct mem_attrib *, struct target_ops *)) > @@ -4033,6 +4028,26 @@ target_store_registers (struct regcache *regcache, int regno) > noprocess (); > } > > +/* See target.h. */ > + > +void > +target_prepare_to_store (struct regcache *regcache) > +{ > + struct target_ops *t; > + > + for (t = current_target.beneath; t != NULL; t = t->beneath) > + { > + if (t->to_prepare_to_store != NULL) > + { > + t->to_prepare_to_store (t, regcache); > + if (targetdebug) > + fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store"); fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n"); > + > + return; > + } > + } > +} > + > int > target_core_of_thread (ptid_t ptid) > { > @@ -4485,14 +4500,6 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags) > tcomplain (); > } > > -static void > -debug_to_prepare_to_store (struct regcache *regcache) > -{ > - debug_target.to_prepare_to_store (regcache); > - > - fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n"); > -} > - > static int > deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, > int write, struct mem_attrib *attrib, > @@ -4944,7 +4951,6 @@ setup_target_debug (void) > > current_target.to_open = debug_to_open; > current_target.to_post_attach = debug_to_post_attach; > - current_target.to_prepare_to_store = debug_to_prepare_to_store; > current_target.deprecated_xfer_memory = deprecated_debug_xfer_memory; > current_target.to_files_info = debug_to_files_info; > current_target.to_insert_breakpoint = debug_to_insert_breakpoint; > diff --git a/gdb/target.h b/gdb/target.h > index 1bf716e..e890999 100644 > --- a/gdb/target.h > +++ b/gdb/target.h > @@ -434,7 +434,7 @@ struct target_ops > ptid_t, struct target_waitstatus *, int); > void (*to_fetch_registers) (struct target_ops *, struct regcache *, int); > void (*to_store_registers) (struct target_ops *, struct regcache *, int); > - 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 > @@ -1055,8 +1055,7 @@ extern void target_store_registers (struct regcache *regcache, int regs); > that REGISTERS contains all the registers from the program being > debugged. */ > > -#define target_prepare_to_store(regcache) \ > - (*current_target.to_prepare_to_store) (regcache) > +extern void target_prepare_to_store (struct regcache *); > > /* Determine current address space of thread PTID. */ > > -- > 1.7.1