Re: record mode supposed to work on x86_64-linux?

Hui Zhu
2009-05-16T09:51:53Z

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

Sorry. I made a mistake in gdbarch.sh.
How about this one?

Thanks,
Hui

On Sat, May 16, 2009 at 17:27, Andi Kleen <andi@firstfloor.org> wrote:
> On Sat, May 16, 2009 at 05:09:12PM +0800, Hui Zhu wrote:
>> 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?
>
> Gets
>
> ../../src/gdb/gdbarch.c:648: internal-error: verify_gdbarch: the following are invalid ...
>        support_process_record
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
>
> at startup. I haven't tried further.
>
> -Andi
>

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

---
gdbarch.c | 23 +++++++++++++++++++++++
gdbarch.h | 6 ++++++
gdbarch.sh | 4 ++++
i386-linux-tdep.c | 2 ++
record.c | 6 +++---
5 files changed, 38 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,7 @@ 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 */
+ /* Skip verify of support_process_record, invalid_p == 0 */
/* 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 +1093,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 +3289,23 @@ set_gdbarch_process_record (struct gdbar
gdbarch->process_record = process_record;
}

+int
+gdbarch_support_process_record (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ /* Skip verify of support_process_record, invalid_p == 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::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)