summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2016-06-10 14:49:50 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2016-07-06 08:31:20 +0200
commitb323ffa153904701ba9eaa352148d02dbb895434 (patch)
treec5fab2052b0fef092652e99d7342e2be87905371
parente0139aa5f27ebef0bd92a182beca659e169560ef (diff)
downloadbinutils-gdb-b323ffa153904701ba9eaa352148d02dbb895434.tar.gz
record: do not allow record goto on a running thread
We can't start replaying if the selected thread is currently running. Throw an error in this case. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * record.c: Include gdbthread.h (require_not_running): New. (record_goto, cmd_record_goto_begin, cmd_record_goto_end): Call require_not_running. Change-Id: I15888d668b6011217337cf3a63d3618fb044c023
-rw-r--r--gdb/record.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/record.c b/gdb/record.c
index 1af134f68fe..ef154593e32 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -26,6 +26,7 @@
#include "common/common-utils.h"
#include "cli/cli-utils.h"
#include "disasm.h"
+#include "gdbthread.h"
#include <ctype.h>
@@ -80,6 +81,16 @@ require_record_target (void)
return t;
}
+/* Check that the inferior thread is not running. Throw an error if it is. */
+
+static void
+require_not_running (void)
+{
+ if (is_running (inferior_ptid))
+ error (_("Cannot execute this command while "
+ "the selected thread is running."));
+}
+
/* See record.h. */
void
@@ -342,6 +353,7 @@ record_goto (const char *arg)
insn = parse_and_eval_long (arg);
require_record_target ();
+ require_not_running ();
target_goto_record (insn);
}
@@ -365,6 +377,7 @@ cmd_record_goto_begin (char *arg, int from_tty)
error (_("Junk after argument: %s."), arg);
require_record_target ();
+ require_not_running ();
target_goto_record_begin ();
}
@@ -377,6 +390,7 @@ cmd_record_goto_end (char *arg, int from_tty)
error (_("Junk after argument: %s."), arg);
require_record_target ();
+ require_not_running ();
target_goto_record_end ();
}