* [PATCH] prec: add a switch for memory doesn't record query
@ 2010-06-18 2:38 Hui Zhu
2010-06-18 5:00 ` Hui Zhu
0 siblings, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2010-06-18 2:38 UTC (permalink / raw)
To: gdb-patches ml
Hi,
Prec will output a lot of memory warning when it working. But
actually, most of this memory issue can be handle by prec itself. So
I post this patch to change this warning to query and add a switch to
these query (default is OFF).
Thanks,
Hui
2010-06-18 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-18 Hui Zhu <teawater@gmail.com>
* gdb.texinfo: (Process Record and Replay): Add documentation
for command "set record memory-query".
---
doc/gdb.texinfo | 13 +++++++
i386-tdep.c | 97 ++++++++++++++++++++++++++++++++++++++++----------------
linux-record.c | 25 ++++++++------
record.c | 15 ++++++++
record.h | 1
5 files changed, 115 insertions(+), 36 deletions(-)
--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -5676,6 +5676,19 @@ oldest record to make room for each new
@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 PREC cannot record memory change of next
+instruction. If ON, @value{GDBN} will query when PREC cannot record
+memory change of next instruction.
+
+If this option is OFF(the default), @value{GDBN} will auto ignore this
+issue. PREC can handle it with itself.
+
+@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
--- a/i386-tdep.c
+++ b/i386-tdep.c
@@ -3461,10 +3461,21 @@ i386_record_lea_modrm (struct i386_recor
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;
}
@@ -4355,11 +4366,20 @@ i386_process_record (struct gdbarch *gdb
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
{
@@ -5036,11 +5056,20 @@ i386_process_record (struct gdbarch *gdb
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
{
@@ -5593,12 +5622,20 @@ i386_process_record (struct gdbarch *gdb
}
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
{
@@ -5642,12 +5679,20 @@ i386_process_record (struct gdbarch *gdb
/* 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
{
--- a/linux-record.c
+++ b/linux-record.c
@@ -695,21 +695,26 @@ record_linux_system_call (enum gdb_sysca
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;
--- a/record.c
+++ b/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 unlimi
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);
}
--- a/record.h
+++ b/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);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] prec: add a switch for memory doesn't record query 2010-06-18 2:38 [PATCH] prec: add a switch for memory doesn't record query Hui Zhu @ 2010-06-18 5:00 ` Hui Zhu 2010-06-18 7:34 ` Eli Zaretskii 0 siblings, 1 reply; 8+ messages in thread From: Hui Zhu @ 2010-06-18 5:00 UTC (permalink / raw) To: gdb-patches ml Some words in the doc is not very well. Did some small change. 2010-06-18 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-18 Hui Zhu <teawater@gmail.com> * gdb.texinfo: (Process Record and Replay): Add documentation for command "set record memory-query". --- doc/gdb.texinfo | 13 +++++++ i386-tdep.c | 97 ++++++++++++++++++++++++++++++++++++++++---------------- linux-record.c | 25 ++++++++------ record.c | 15 ++++++++ record.h | 1 5 files changed, 115 insertions(+), 36 deletions(-) --- a/doc/gdb.texinfo +++ b/doc/gdb.texinfo @@ -5676,6 +5676,19 @@ oldest record to make room for each new @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 PREC cannot record memory change of next +instruction. If ON, @value{GDBN} will query when it cannot record +memory change of next instruction. + +If this option is OFF(the default), @value{GDBN} will auto ignore this +issue. It can handle it with itself. + +@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 --- a/i386-tdep.c +++ b/i386-tdep.c @@ -3461,10 +3461,21 @@ i386_record_lea_modrm (struct i386_recor 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; } @@ -4355,11 +4366,20 @@ i386_process_record (struct gdbarch *gdb 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 { @@ -5036,11 +5056,20 @@ i386_process_record (struct gdbarch *gdb 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 { @@ -5593,12 +5622,20 @@ i386_process_record (struct gdbarch *gdb } 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 { @@ -5642,12 +5679,20 @@ i386_process_record (struct gdbarch *gdb /* 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 { --- a/linux-record.c +++ b/linux-record.c @@ -695,21 +695,26 @@ record_linux_system_call (enum gdb_sysca 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; --- a/record.c +++ b/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 unlimi 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); } --- a/record.h +++ b/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); ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] prec: add a switch for memory doesn't record query 2010-06-18 5:00 ` Hui Zhu @ 2010-06-18 7:34 ` Eli Zaretskii 2010-06-20 6:02 ` Hui Zhu 0 siblings, 1 reply; 8+ messages in thread From: Eli Zaretskii @ 2010-06-18 7:34 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches > From: Hui Zhu <teawater@gmail.com> > Date: Fri, 18 Jun 2010 12:59:49 +0800 > > Some words in the doc is not very well. Did some small change. Thanks. > +Control the behavior when PREC cannot record memory change of next > +instruction. If ON, @value{GDBN} will query when it cannot record > +memory change of next instruction. First, please don't use "PREC", this is not a term we use in the manual. Second, I think a short explanation of why this could happen is in order. > +If this option is OFF(the default), @value{GDBN} will auto ignore this > +issue. It can handle it with itself. This is too mysterious. I think we should have at least some explanation of what this auto handling does. Otherwise, the reader will not be able to decide whether to set this on or not. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] prec: add a switch for memory doesn't record query 2010-06-18 7:34 ` Eli Zaretskii @ 2010-06-20 6:02 ` Hui Zhu 2010-06-20 15:08 ` Eli Zaretskii 0 siblings, 1 reply; 8+ messages in thread From: Hui Zhu @ 2010-06-20 6:02 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches Thanks Eli. What about following? @kindex set record memory-query @item set record memory-query Control the behavior when @value{GDBN} cannot record memory change of next instruction. If ON, @value{GDBN} will query when it cannot record memory change of next instruction. If this option is OFF(the default), @value{GDBN} will auto ignore this issue. When @value{GDBN} replay to this execution log, it will mark this log as not accessible, then it will not affect the replay. Hui On Fri, Jun 18, 2010 at 15:34, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Hui Zhu <teawater@gmail.com> >> Date: Fri, 18 Jun 2010 12:59:49 +0800 >> >> Some words in the doc is not very well. Did some small change. > > Thanks. > >> +Control the behavior when PREC cannot record memory change of next >> +instruction. If ON, @value{GDBN} will query when it cannot record >> +memory change of next instruction. > > First, please don't use "PREC", this is not a term we use in the > manual. > > Second, I think a short explanation of why this could happen is in > order. > >> +If this option is OFF(the default), @value{GDBN} will auto ignore this >> +issue. It can handle it with itself. > > This is too mysterious. I think we should have at least some > explanation of what this auto handling does. Otherwise, the reader > will not be able to decide whether to set this on or not. > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] prec: add a switch for memory doesn't record query 2010-06-20 6:02 ` Hui Zhu @ 2010-06-20 15:08 ` Eli Zaretskii 2010-06-20 16:30 ` Hui Zhu 0 siblings, 1 reply; 8+ messages in thread From: Eli Zaretskii @ 2010-06-20 15:08 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches > From: Hui Zhu <teawater@gmail.com> > Date: Sun, 20 Jun 2010 14:01:38 +0800 > Cc: gdb-patches@sourceware.org > > Thanks Eli. What about following? > > @kindex set record memory-query > @item set record memory-query > Control the behavior when @value{GDBN} cannot record memory change > of next instruction. If ON, @value{GDBN} will query when it cannot > record memory change of next instruction. > > If this option is OFF(the default), @value{GDBN} will auto ignore this > issue. When @value{GDBN} replay to this execution log, it will mark > this log as not accessible, then it will not affect the replay. A slight rewording: @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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] prec: add a switch for memory doesn't record query 2010-06-20 15:08 ` Eli Zaretskii @ 2010-06-20 16:30 ` Hui Zhu 2010-06-20 17:30 ` Eli Zaretskii 0 siblings, 1 reply; 8+ messages in thread From: Hui Zhu @ 2010-06-20 16:30 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches On Sun, Jun 20, 2010 at 23:06, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Hui Zhu <teawater@gmail.com> >> Date: Sun, 20 Jun 2010 14:01:38 +0800 >> Cc: gdb-patches@sourceware.org >> >> Thanks Eli. What about following? >> >> @kindex set record memory-query >> @item set record memory-query >> Control the behavior when @value{GDBN} cannot record memory change >> of next instruction. If ON, @value{GDBN} will query when it cannot >> record memory change of next instruction. >> >> If this option is OFF(the default), @value{GDBN} will auto ignore this >> issue. When @value{GDBN} replay to this execution log, it will mark >> this log as not accessible, then it will not affect the replay. > > A slight rewording: > > @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. > Thanks Eli. I make a new patch according to it. Please help me review it. Best, Hui 2010-06-21 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 Hui Zhu <teawater@gmail.com> * gdb.texinfo: (Process Record and Replay): Add documentation for command "set record memory-query". --- doc/gdb.texinfo | 13 +++++++ i386-tdep.c | 97 ++++++++++++++++++++++++++++++++++++++++---------------- linux-record.c | 25 ++++++++------ record.c | 15 ++++++++ record.h | 1 5 files changed, 115 insertions(+), 36 deletions(-) Index: gdb/doc/gdb.texinfo =================================================================== --- gdb.orig/doc/gdb.texinfo 2010-06-21 00:24:59.322968516 +0800 +++ gdb/doc/gdb.texinfo 2010-06-21 00:26:05.818973067 +0800 @@ -5694,6 +5694,22 @@ @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 Index: gdb/i386-tdep.c =================================================================== --- gdb.orig/i386-tdep.c 2010-06-21 00:24:59.246972280 +0800 +++ gdb/i386-tdep.c 2010-06-21 00:25:05.174970362 +0800 @@ -3461,10 +3461,21 @@ 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; } @@ -4355,11 +4366,20 @@ 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 { @@ -5036,11 +5056,20 @@ 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 { @@ -5593,12 +5622,20 @@ } 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 { @@ -5642,12 +5679,20 @@ /* 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 { Index: gdb/linux-record.c =================================================================== --- gdb.orig/linux-record.c 2010-06-21 00:24:59.190969857 +0800 +++ gdb/linux-record.c 2010-06-21 00:25:05.174970362 +0800 @@ -695,21 +695,26 @@ 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; Index: gdb/record.c =================================================================== --- gdb.orig/record.c 2010-06-21 00:24:59.430973471 +0800 +++ gdb/record.c 2010-06-21 00:25:05.178973118 +0800 @@ -152,6 +152,10 @@ /* 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 @@ 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); } Index: gdb/record.h =================================================================== --- gdb.orig/record.h 2010-06-21 00:24:59.358971401 +0800 +++ gdb/record.h 2010-06-21 00:25:05.178973118 +0800 @@ -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); ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] prec: add a switch for memory doesn't record query 2010-06-20 16:30 ` Hui Zhu @ 2010-06-20 17:30 ` Eli Zaretskii 2010-06-25 6:13 ` Hui Zhu 0 siblings, 1 reply; 8+ messages in thread From: Eli Zaretskii @ 2010-06-20 17:30 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches > From: Hui Zhu <teawater@gmail.com> > Date: Mon, 21 Jun 2010 00:29:55 +0800 > Cc: gdb-patches@sourceware.org > > Thanks Eli. I make a new patch according to it. Please help me review it. The parts for the manual are okay. Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] prec: add a switch for memory doesn't record query 2010-06-20 17:30 ` Eli Zaretskii @ 2010-06-25 6:13 ` Hui Zhu 0 siblings, 0 replies; 8+ messages in thread From: Hui Zhu @ 2010-06-25 6:13 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches Checked in. Thanks, Hui On Mon, Jun 21, 2010 at 01:28, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Hui Zhu <teawater@gmail.com> >> Date: Mon, 21 Jun 2010 00:29:55 +0800 >> Cc: gdb-patches@sourceware.org >> >> Thanks Eli. I make a new patch according to it. Please help me review it. > > The parts for the manual are okay. Thanks. > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-06-25 6:13 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-06-18 2:38 [PATCH] prec: add a switch for memory doesn't record query Hui Zhu 2010-06-18 5:00 ` Hui Zhu 2010-06-18 7:34 ` Eli Zaretskii 2010-06-20 6:02 ` Hui Zhu 2010-06-20 15:08 ` Eli Zaretskii 2010-06-20 16:30 ` Hui Zhu 2010-06-20 17:30 ` Eli Zaretskii 2010-06-25 6:13 ` Hui Zhu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox