Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: teawater <teawater@gmail.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [RFA] Process record and replay, 4/10
Date: Thu, 06 Nov 2008 07:48:00 -0000	[thread overview]
Message-ID: <daef60380811052347y4077eb2ehfb890faf45c6e87b@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]

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-06  Hui Zhu  <teawater@gmail.com>

	* 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(+)

[-- Attachment #2: target_record_beneath.txt --]
[-- Type: text/plain, Size: 1836 bytes --]

--- 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);
 
@@ -387,6 +388,12 @@ update_current_target (void)
       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);
@@ -476,6 +483,35 @@ update_current_target (void)
       /* Do not inherit to_memory_map.  */
       /* Do not inherit to_flash_erase.  */
       /* Do not inherit to_flash_done.  */
+
+      /* Set the real beneath function pointers. */
+      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
 

             reply	other threads:[~2008-11-06  7:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-06  7:48 teawater [this message]
2008-11-07 15:12 ` Eli Zaretskii
2008-11-08  6:29   ` teawater
2008-11-08  9:28     ` Eli Zaretskii
2008-11-11  5:50       ` teawater
2008-11-13 15:09         ` teawater
2008-11-14  0:27           ` Eli Zaretskii
2008-11-14 15:06             ` teawater
2008-11-14 15:56         ` Eli Zaretskii
2008-11-14 16:29           ` teawater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=daef60380811052347y4077eb2ehfb890faf45c6e87b@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox