aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMarkus Metzger <mmetzger@sourceware.org>2013-05-15 07:04:12 +0000
committerMarkus Metzger <mmetzger@sourceware.org>2013-05-15 07:04:12 +0000
commit742ce053c16cb345eeddfdb0acf0c6658ce8e126 (patch)
tree264ac330df89b1e6d7adae9977cdad162bda12f7 /gdb
parentc495064debc2cae93d0cb3710e4bf13bb9a0738a (diff)
downloadfsf-binutils-gdb-742ce053c16cb345eeddfdb0acf0c6658ce8e126.zip
fsf-binutils-gdb-742ce053c16cb345eeddfdb0acf0c6658ce8e126.tar.gz
fsf-binutils-gdb-742ce053c16cb345eeddfdb0acf0c6658ce8e126.tar.bz2
The "record goto" command scans its arguments for "begin", "start", or "end".
Turn those into sub-commands. Document the "record goto" command.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo17
-rw-r--r--gdb/record.c54
4 files changed, 72 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c076bde..7c6e1f0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2013-05-15 Markus Metzger <markus.t.metzger@intel.com>
+
+ * record.c (record_goto_cmdlist): New.
+ (cmd_record_goto): Split into this ...
+ (cmd_record_goto_begin): ... this
+ (cmd_record_goto_end): ... and this.
+ (_initialize_record): Change "record goto" to prefix command.
+ Add commands for "record goto begin" and "record goto end".
+ Add an alias for "record goto start" to "record goto begin".
+
2013-05-14 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (convert_linespec_to_sals): New comment for
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 908fbb4..b14e17a 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-15 Markus Metzger <markus.t.metzger@intel.com>
+
+ * gdb.texinfo (Process Record and Replay): Document the
+ "record goto" command and its sub-commands.
+
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Backtrace): Add "no-filter" argument.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1869d74..02c2408 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6209,6 +6209,23 @@ usual ``live'' debugging of the process from that state.
When the inferior process exits, or @value{GDBN} detaches from it,
process record and replay target will automatically stop itself.
+@kindex record goto
+@item record goto
+Go to a specific location in the execution log. There are several
+ways to specify the location to go to:
+
+@table @code
+@item record goto begin
+@itemx record goto start
+Go to the beginning of the execution log.
+
+@item record goto end
+Go to the end of the execution log.
+
+@item record goto @var{n}
+Go to instruction number @var{n} in the execution log.
+@end table
+
@kindex record save
@item record save @var{filename}
Save the execution log to a file @file{@var{filename}}.
diff --git a/gdb/record.c b/gdb/record.c
index 76d9fd2..cbbe365 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -48,6 +48,7 @@ static unsigned int record_call_history_size = 10;
static unsigned int record_call_history_size_setshow_var;
struct cmd_list_element *record_cmdlist = NULL;
+struct cmd_list_element *record_goto_cmdlist = NULL;
struct cmd_list_element *set_record_cmdlist = NULL;
struct cmd_list_element *show_record_cmdlist = NULL;
struct cmd_list_element *info_record_cmdlist = NULL;
@@ -314,23 +315,39 @@ cmd_record_save (char *args, int from_tty)
void
cmd_record_goto (char *arg, int from_tty)
{
- require_record_target ();
+ ULONGEST insn;
if (arg == NULL || *arg == '\0')
error (_("Command requires an argument (insn number to go to)."));
- if (strncmp (arg, "start", strlen ("start")) == 0
- || strncmp (arg, "begin", strlen ("begin")) == 0)
- target_goto_record_begin ();
- else if (strncmp (arg, "end", strlen ("end")) == 0)
- target_goto_record_end ();
- else
- {
- ULONGEST insn;
+ insn = parse_and_eval_long (arg);
- insn = parse_and_eval_long (arg);
- target_goto_record (insn);
- }
+ require_record_target ();
+ target_goto_record (insn);
+}
+
+/* The "record goto begin" command. */
+
+static void
+cmd_record_goto_begin (char *arg, int from_tty)
+{
+ if (arg != NULL && *arg != '\0')
+ error (_("Junk after argument: %s."), arg);
+
+ require_record_target ();
+ target_goto_record_begin ();
+}
+
+/* The "record goto end" command. */
+
+static void
+cmd_record_goto_end (char *arg, int from_tty)
+{
+ if (arg != NULL && *arg != '\0')
+ error (_("Junk after argument: %s."), arg);
+
+ require_record_target ();
+ target_goto_record_end ();
}
/* Read an instruction number from an argument string. */
@@ -751,10 +768,19 @@ Default filename is 'gdb_record.<process_id>'."),
&record_cmdlist);
add_alias_cmd ("s", "stop", class_obscure, 1, &record_cmdlist);
- add_cmd ("goto", class_obscure, cmd_record_goto, _("\
+ add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _("\
Restore the program to its state at instruction number N.\n\
Argument is instruction number, as shown by 'info record'."),
- &record_cmdlist);
+ &record_goto_cmdlist, "record goto ", 1, &record_cmdlist);
+
+ add_cmd ("begin", class_obscure, cmd_record_goto_begin,
+ _("Go to the beginning of the execution log."),
+ &record_goto_cmdlist);
+ add_alias_cmd ("start", "begin", class_obscure, 1, &record_goto_cmdlist);
+
+ add_cmd ("end", class_obscure, cmd_record_goto_end,
+ _("Go to the end of the execution log."),
+ &record_goto_cmdlist);
add_cmd ("instruction-history", class_obscure, cmd_record_insn_history, _("\
Print disassembled instructions stored in the execution log.\n\