From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14693 invoked by alias); 20 Nov 2008 01:46:49 -0000 Received: (qmail 14640 invoked by uid 22791); 20 Nov 2008 01:46:46 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 20 Nov 2008 01:46:09 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 1102518009; Wed, 19 Nov 2008 17:46:07 -0800 (PST) Received: from [10.20.92.151] (promb-2s-dhcp151.eng.vmware.com [10.20.92.151]) by mailhost4.vmware.com (Postfix) with ESMTP id 02CB0C9A2C; Wed, 19 Nov 2008 17:46:07 -0800 (PST) Message-ID: <4924C15D.20606@vmware.com> Date: Thu, 20 Nov 2008 04:21:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: teawater CC: "gdb-patches@sourceware.org" Subject: Re: [RFA] Resubmit process record and replay, 4/10 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2008-11/txt/msg00522.txt.bz2 Seems like a couple of people had some doubts about this particular part of the implementation. Does anyone have any alternative suggestions? teawater wrote: > The process record and replay target has six function pointers > record_beneath_to_resume, record_beneath_to_wait, > record_beneath_to_prepare_to_store, record_beneath_to_xfer_partial, > record_beneath_to_insert_breakpoint and > record_beneath_to_remove_breakpoint. > This patch add code to function "update_current_target" make these > pointers always point to the function of lower strata target than > process record and replay target. > > When GDB in record mode, we need to call the really debug function in > low strata target because process record and replay target need call > this function to control the inferior. > > Struct target_ops already has a pointer "beneath" point to low strata > target, but process record and replay target doesn't use it. Because > if low strata target doesn't set some function pointers, process > record and replay target will need to call the function pointers of > the target that is low strata target of this target. If this target > doesn't set them too, it will need to call anothers. So use "beneath" > is not a good choice and "multi-thread" target that need function > pointers of low strata target doesn't use "beneath" too. > > 2008-11-16 Hui Zhu > > * target.c (update_current_target): Set function points > record_beneath_to_resume, > record_beneath_to_wait, > record_beneath_to_prepare_to_store, > record_beneath_to_xfer_partial, > record_beneath_to_insert_breakpoint > and record_beneath_to_remove_breakpoint point to the function > of target that lower than process record and replay target. > > target.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > Following is the diff with the previous patch: > @@ -8,7 +8,7 @@ > > static void target_info (char *, int); > > -@@ -387,6 +388,12 @@ update_current_target (void) > +@@ -405,6 +406,12 @@ > if (!current_target.FIELD) \ > current_target.FIELD = (TARGET)->FIELD > > @@ -21,12 +21,12 @@ > for (t = target_stack; t; t = t->beneath) > { > INHERIT (to_shortname, t); > -@@ -476,6 +483,35 @@ update_current_target (void) > +@@ -494,6 +501,35 @@ > /* Do not inherit to_memory_map. */ > /* Do not inherit to_flash_erase. */ > /* Do not inherit to_flash_done. */ > + > -+ /* Set the real beneath function pointers. */ > ++ /* Set pointers to functions in the target beneath us. */ > + if (t != &record_ops) > + { > + if (!record_beneath_to_resume) > > > ------------------------------------------------------------------------ > > --- a/target.c > +++ b/target.c > @@ -41,6 +41,7 @@ > #include "target-descriptions.h" > #include "gdbthread.h" > #include "solib.h" > +#include "record.h" > > static void target_info (char *, int); > > @@ -405,6 +406,12 @@ > if (!current_target.FIELD) \ > current_target.FIELD = (TARGET)->FIELD > > + record_beneath_to_resume = NULL; > + record_beneath_to_store_registers = NULL; > + record_beneath_to_xfer_partial = NULL; > + record_beneath_to_insert_breakpoint = NULL; > + record_beneath_to_remove_breakpoint = NULL; > + > for (t = target_stack; t; t = t->beneath) > { > INHERIT (to_shortname, t); > @@ -494,6 +501,35 @@ > /* Do not inherit to_memory_map. */ > /* Do not inherit to_flash_erase. */ > /* Do not inherit to_flash_done. */ > + > + /* Set pointers to functions in the target beneath us. */ > + if (t != &record_ops) > + { > + if (!record_beneath_to_resume) > + { > + record_beneath_to_resume = t->to_resume; > + } > + if (!record_beneath_to_wait) > + { > + record_beneath_to_wait = t->to_wait; > + } > + if (!record_beneath_to_store_registers) > + { > + record_beneath_to_store_registers = t->to_store_registers; > + } > + if (!record_beneath_to_xfer_partial) > + { > + record_beneath_to_xfer_partial = t->to_xfer_partial; > + } > + if (!record_beneath_to_insert_breakpoint) > + { > + record_beneath_to_insert_breakpoint = t->to_insert_breakpoint; > + } > + if (!record_beneath_to_remove_breakpoint) > + { > + record_beneath_to_remove_breakpoint = t->to_remove_breakpoint; > + } > + } > } > #undef INHERIT >