]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
btrace: check if we're replaying when setting the replay position to the end
authorMarkus Metzger <markus.t.metzger@intel.com>
Fri, 10 Jun 2016 09:18:08 +0000 (11:18 +0200)
committerMarkus Metzger <markus.t.metzger@intel.com>
Wed, 6 Jul 2016 06:31:20 +0000 (08:31 +0200)
When setting the replay position to the end there is nothing to do if we are
not replaying.  Check that and return immediately.

This avoids printing the current location if we're already at the end.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
gdb/
* record-btrace.c (record_btrace_set_replay): Check if replaying.

testsuite/
* gdb.btrace/record_goto.exp: Test "record goto end" twice.

Change-Id: I4878892408bab293261bbea40d6af28440ff3ec5

gdb/record-btrace.c
gdb/testsuite/gdb.btrace/record_goto.exp

index 24594a96cfc1bf2f05b43adb365f820b7624a3d0..80d9f04a5e1c5c73f0adfa3630dd77b38757d22d 100644 (file)
@@ -2704,7 +2704,12 @@ record_btrace_set_replay (struct thread_info *tp,
   btinfo = &tp->btrace;
 
   if (it == NULL || it->function == NULL)
-    record_btrace_stop_replaying (tp);
+    {
+      if (!btrace_is_replaying (tp))
+       return;
+
+      record_btrace_stop_replaying (tp);
+    }
   else
     {
       if (btinfo->replay == NULL)
index 50b259adb4fd9ba68c83da709851c5c59c3b14ee..45df26148c87539183b5ed9563087f790a640fdc 100644 (file)
@@ -160,6 +160,9 @@ gdb_test "record instruction-history -" [multi_line \
 # check that we can go to the end of the trace
 gdb_test "record goto end" ".*main \\(\\) at record_goto.c:50.*"
 
+# check that we don't repeat the current location if we go to the end again
+gdb_test_no_output "record goto end" "goto end again"
+
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci" [multi_line \
   "14\t      fun2\tinst 35,36" \