aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Zhu <teawater@gmail.com>2010-06-22 02:15:46 +0000
committerHui Zhu <teawater@gmail.com>2010-06-22 02:15:46 +0000
commitbb08c4320780f40a8a5210164fe5f13df795460c (patch)
treed95469f4483845828e398024973a3502bbd42c4c
parentb55078be0adf688f7da6bc6feb6f7687dc319cc4 (diff)
downloadgdb-bb08c4320780f40a8a5210164fe5f13df795460c.zip
gdb-bb08c4320780f40a8a5210164fe5f13df795460c.tar.gz
gdb-bb08c4320780f40a8a5210164fe5f13df795460c.tar.bz2
2010-06-22 Hui Zhu <teawater@gmail.com>
* i386-tdep.c (i386_record_lea_modrm): Change warning to query. (i386_process_record): Ditto. * record.c (record_memory_query): New variable. (_initialize_record): New command "set record memory-query". * record.h (record_memory_query): New extern. 2010-06-22 Hui Zhu <teawater@gmail.com> * gdb.texinfo: (Process Record and Replay): Add documentation for command "set record memory-query".
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo16
-rw-r--r--gdb/i386-tdep.c97
-rw-r--r--gdb/linux-record.c25
-rw-r--r--gdb/record.c15
-rw-r--r--gdb/record.h1
7 files changed, 131 insertions, 36 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 568f55c..1591aa6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-22 Hui Zhu <teawater@gmail.com>
+
+ * i386-tdep.c (i386_record_lea_modrm): Change warning to query.
+ (i386_process_record): Ditto.
+ * record.c (record_memory_query): New variable.
+ (_initialize_record): New command "set record memory-query".
+ * record.h (record_memory_query): New extern.
+
2010-06-21 Doug Evans <dje@google.com>
* i386-tdep.h (i386_displaced_step_copy_insn): Declare.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index cc85752..9736fd8 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-22 Hui Zhu <teawater@gmail.com>
+
+ * gdb.texinfo: (Process Record and Replay): Add documentation
+ for command "set record memory-query".
+
2010-06-21 Stan Shebs <stan@codesourcery.com>
* gdb.texinfo: Relicense under GFDL version 1.3.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index bc1dbec..2f5ba45 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -5694,6 +5694,22 @@ oldest record to make room for each new one, without asking.
@item show record stop-at-limit
Show the current setting of @code{stop-at-limit}.
+@kindex set record memory-query
+@item set record memory-query
+Control the behavior when @value{GDBN} is unable to record memory
+changes caused by an instruction. If ON, @value{GDBN} will query
+whether to stop the inferior in that case.
+
+If this option is OFF (the default), @value{GDBN} will automatically
+ignore the effect of such instructions on memory. Later, when
+@value{GDBN} replays this execution log, it will mark the log of this
+instruction as not accessible, and it will not affect the replay
+results.
+
+@kindex show record memory-query
+@item show record memory-query
+Show the current setting of @code{memory-query}.
+
@kindex info record
@item info record
Show various statistics about the state of process record and its
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index e0f519d..435b623 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3503,10 +3503,21 @@ i386_record_lea_modrm (struct i386_record_s *irp)
if (irp->override >= 0)
{
- warning (_("Process record ignores the memory change "
- "of instruction at address %s because it "
- "can't get the value of the segment register."),
- paddress (gdbarch, irp->orig_addr));
+ if (record_memory_query)
+ {
+ int q;
+
+ target_terminal_ours ();
+ q = yquery (_("\
+Process record ignores the memory change of instruction at address %s\n\
+because it can't get the value of the segment register.\n\
+Do you want to stop the program?"),
+ paddress (gdbarch, irp->orig_addr));
+ target_terminal_inferior ();
+ if (q)
+ return -1;
+ }
+
return 0;
}
@@ -4397,11 +4408,20 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0xa3:
if (ir.override >= 0)
{
- warning (_("Process record ignores the memory change "
- "of instruction at address %s because "
- "it can't get the value of the segment "
- "register."),
- paddress (gdbarch, ir.orig_addr));
+ if (record_memory_query)
+ {
+ int q;
+
+ target_terminal_ours ();
+ q = yquery (_("\
+Process record ignores the memory change of instruction at address %s\n\
+because it can't get the value of the segment register.\n\
+Do you want to stop the program?"),
+ paddress (gdbarch, ir.orig_addr));
+ target_terminal_inferior ();
+ if (q)
+ return -1;
+ }
}
else
{
@@ -5078,11 +5098,20 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
if (ir.aflag && (es != ds))
{
/* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */
- warning (_("Process record ignores the memory "
- "change of instruction at address %s "
- "because it can't get the value of the "
- "ES segment register."),
- paddress (gdbarch, ir.orig_addr));
+ if (record_memory_query)
+ {
+ int q;
+
+ target_terminal_ours ();
+ q = yquery (_("\
+Process record ignores the memory change of instruction at address %s\n\
+because it can't get the value of the segment register.\n\
+Do you want to stop the program?"),
+ paddress (gdbarch, ir.orig_addr));
+ target_terminal_inferior ();
+ if (q)
+ return -1;
+ }
}
else
{
@@ -5635,12 +5664,20 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
if (ir.override >= 0)
{
- warning (_("Process record ignores the memory "
- "change of instruction at "
- "address %s because it can't get "
- "the value of the segment "
- "register."),
- paddress (gdbarch, ir.orig_addr));
+ if (record_memory_query)
+ {
+ int q;
+
+ target_terminal_ours ();
+ q = yquery (_("\
+Process record ignores the memory change of instruction at address %s\n\
+because it can't get the value of the segment register.\n\
+Do you want to stop the program?"),
+ paddress (gdbarch, ir.orig_addr));
+ target_terminal_inferior ();
+ if (q)
+ return -1;
+ }
}
else
{
@@ -5684,12 +5721,20 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
/* sidt */
if (ir.override >= 0)
{
- warning (_("Process record ignores the memory "
- "change of instruction at "
- "address %s because it can't get "
- "the value of the segment "
- "register."),
- paddress (gdbarch, ir.orig_addr));
+ if (record_memory_query)
+ {
+ int q;
+
+ target_terminal_ours ();
+ q = yquery (_("\
+Process record ignores the memory change of instruction at address %s\n\
+because it can't get the value of the segment register.\n\
+Do you want to stop the program?"),
+ paddress (gdbarch, ir.orig_addr));
+ target_terminal_inferior ();
+ if (q)
+ return -1;
+ }
}
else
{
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 1311f001..f07a889 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -695,21 +695,26 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_munmap:
{
- int q;
ULONGEST len;
regcache_raw_read_unsigned (regcache, tdep->arg1,
&tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
- target_terminal_ours ();
- q = yquery (_("The next instruction is syscall munmap. "
- "It will free the memory addr = 0x%s len = %u. "
- "It will make record target get error. "
- "Do you want to stop the program?"),
- OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
- target_terminal_inferior ();
- if (q)
- return 1;
+ if (record_memory_query)
+ {
+ int q;
+
+ target_terminal_ours ();
+ q = yquery (_("\
+The next instruction is syscall munmap.\n\
+It will free the memory addr = 0x%s len = %u.\n\
+It will make record target cannot record some memory change.\n\
+Do you want to stop the program?"),
+ OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
+ target_terminal_inferior ();
+ if (q)
+ return 1;
+ }
}
break;
diff --git a/gdb/record.c b/gdb/record.c
index b3d11b6..595e087 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -152,6 +152,10 @@ struct record_entry
/* This is the debug switch for process record. */
int record_debug = 0;
+/* If true, query if PREC cannot record memory
+ change of next instruction. */
+int record_memory_query = 0;
+
struct record_core_buf_entry
{
struct record_core_buf_entry *prev;
@@ -2730,4 +2734,15 @@ record/replay buffer. Zero means unlimited. Default is 200000."),
Restore the program to its state at instruction number N.\n\
Argument is instruction number, as shown by 'info record'."),
&record_cmdlist);
+
+ add_setshow_boolean_cmd ("memory-query", no_class,
+ &record_memory_query, _("\
+Set whether query if PREC cannot record memory change of next instruction."),
+ _("\
+Show whether query if PREC cannot record memory change of next instruction."),
+ _("\
+Default is OFF.\n\
+When ON, query if PREC cannot record memory change of next instruction."),
+ NULL, NULL,
+ &set_record_cmdlist, &show_record_cmdlist);
}
diff --git a/gdb/record.h b/gdb/record.h
index 36fbfd6..a4b20d2 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -23,6 +23,7 @@
#define RECORD_IS_USED (current_target.to_stratum == record_stratum)
extern int record_debug;
+extern int record_memory_query;
extern int record_arch_list_add_reg (struct regcache *regcache, int num);
extern int record_arch_list_add_mem (CORE_ADDR addr, int len);