Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: gdb@sourceware.org
Subject: Re: record mode supposed to work on x86_64-linux?
Date: Sat, 16 May 2009 09:09:00 -0000	[thread overview]
Message-ID: <daef60380905160209q49bccf17y2f95659340aba79c@mail.gmail.com> (raw)
In-Reply-To: <20090516081033.GI16682@one.firstfloor.org>

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

Hi Andi,

Thanks for remind me.
I make a patch for it.  But I don't have a x86-64 close to me now.
Could you help me test it?

Thanks,
Hui

On Sat, May 16, 2009 at 16:10, Andi Kleen <andi@firstfloor.org> wrote:
> On Sat, May 16, 2009 at 09:48:09AM +0800, Hui Zhu wrote:
>> No.  Prec just support x86 now.
>> I am working on x86-64 support.
>
> Ok. But should it give a error message then when the target is not
> supported?
>
> -Andi
>
> --
> ak@linux.intel.com -- Speaking for myself only.
>

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

---
 gdbarch.c         |   25 +++++++++++++++++++++++++
 gdbarch.h         |    6 ++++++
 gdbarch.sh        |    4 ++++
 i386-linux-tdep.c |    2 ++
 record.c          |    6 +++---
 5 files changed, 40 insertions(+), 3 deletions(-)

--- a/gdbarch.c
+++ b/gdbarch.c
@@ -240,6 +240,7 @@ struct gdbarch
   gdbarch_static_transform_name_ftype *static_transform_name;
   int sofun_address_maybe_missing;
   gdbarch_process_record_ftype *process_record;
+  int support_process_record;
   gdbarch_target_signal_from_host_ftype *target_signal_from_host;
   gdbarch_target_signal_to_host_ftype *target_signal_to_host;
   gdbarch_get_siginfo_type_ftype *get_siginfo_type;
@@ -376,6 +377,7 @@ struct gdbarch startup_gdbarch =
   0,  /* static_transform_name */
   0,  /* sofun_address_maybe_missing */
   0,  /* process_record */
+  0,  /* support_process_record */
   default_target_signal_from_host,  /* target_signal_from_host */
   default_target_signal_to_host,  /* target_signal_to_host */
   0,  /* get_siginfo_type */
@@ -633,6 +635,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of static_transform_name, has predicate */
   /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
   /* Skip verify of process_record, has predicate */
+  if (gdbarch->support_process_record == 0)
+    fprintf_unfiltered (log, "\n\tsupport_process_record");
   /* Skip verify of target_signal_from_host, invalid_p == 0 */
   /* Skip verify of target_signal_to_host, invalid_p == 0 */
   /* Skip verify of get_siginfo_type, has predicate */
@@ -1090,6 +1094,9 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: static_transform_name = <%s>\n",
                       host_address_to_string (gdbarch->static_transform_name));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: support_process_record = %s\n",
+                      plongest (gdbarch->support_process_record));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: target_desc = %s\n",
                       host_address_to_string (gdbarch->target_desc));
   fprintf_unfiltered (file,
@@ -3283,6 +3290,24 @@ set_gdbarch_process_record (struct gdbar
   gdbarch->process_record = process_record;
 }
 
+int
+gdbarch_support_process_record (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Check variable changed from pre-default.  */
+  gdb_assert (gdbarch->support_process_record != 0);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_support_process_record called\n");
+  return gdbarch->support_process_record;
+}
+
+void
+set_gdbarch_support_process_record (struct gdbarch *gdbarch,
+                                    int support_process_record)
+{
+  gdbarch->support_process_record = support_process_record;
+}
+
 enum target_signal
 gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo)
 {
--- a/gdbarch.h
+++ b/gdbarch.h
@@ -829,6 +829,12 @@ typedef int (gdbarch_process_record_ftyp
 extern int gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
 extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record);
 
+/* If the target of architecture support process record and replay, This
+   variable will be set to true. */
+
+extern int gdbarch_support_process_record (struct gdbarch *gdbarch);
+extern void set_gdbarch_support_process_record (struct gdbarch *gdbarch, int support_process_record);
+
 /* Signal translation: translate inferior's signal (host's) number into
    GDB's representation. */
 
--- a/gdbarch.sh
+++ b/gdbarch.sh
@@ -715,6 +715,10 @@ v:int:sofun_address_maybe_missing:::0:0:
 # Return -1 if something goes wrong, 0 otherwise.
 M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr
 
+# If the target of architecture support process record and replay, This
+# variable will be set to true.
+v:int:support_process_record:::0:0
+
 # Signal translation: translate inferior's signal (host's) number into
 # GDB's representation.
 m:enum target_signal:target_signal_from_host:int signo:signo::default_target_signal_from_host::0
--- a/i386-linux-tdep.c
+++ b/i386-linux-tdep.c
@@ -613,6 +613,8 @@ i386_linux_init_abi (struct gdbarch_info
   tdep->sc_reg_offset = i386_linux_sc_reg_offset;
   tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset);
 
+  set_gdbarch_support_process_record (gdbarch, 1);
+
   /* Initialize the i386_linux_record_tdep.  */
   i386_linux_record_tdep.size__old_kernel_stat =
     I386_LINUX_RECORD_SIZE__old_kernel_stat;
--- a/record.c
+++ b/record.c
@@ -427,9 +427,9 @@ record_open (char *name, int from_tty)
     error (_("Process record target can't debug inferior in asynchronous "
 	     "mode (target-async)."));
 
-  if (!gdbarch_process_record_p (current_gdbarch))
-    error (_("Process record: the current architecture doesn't support "
-	     "record function."));
+  if (!gdbarch_support_process_record (current_gdbarch))
+    error (_("Process record: the current target of architecture doesn't "
+             "support record function."));
 
   /* Check if record target is already running.  */
   if (current_target.to_stratum == record_stratum)

  reply	other threads:[~2009-05-16  9:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15 18:41 Andi Kleen
2009-05-16  1:48 ` Hui Zhu
2009-05-16  8:05   ` Andi Kleen
2009-05-16  9:09     ` Hui Zhu [this message]
2009-05-16  9:21       ` Andi Kleen
2009-05-16  9:51         ` Hui Zhu
2009-05-16 11:54           ` Andi Kleen
2009-05-16 16:35           ` Pedro Alves
2009-05-17  0:15             ` Hui Zhu
2009-05-17 11:51               ` Pedro Alves
2009-05-17 12:28                 ` Hui Zhu
2009-05-17 12:30                   ` Pedro Alves
2009-05-17 12:40                     ` Hui Zhu

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=daef60380905160209q49bccf17y2f95659340aba79c@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=andi@firstfloor.org \
    --cc=gdb@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