]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
btrace: clear thread stopped state when stopping replaying
authorMarkus Metzger <markus.t.metzger@intel.com>
Tue, 12 Aug 2025 12:33:48 +0000 (12:33 +0000)
committerMarkus Metzger <markus.t.metzger@intel.com>
Mon, 3 Nov 2025 06:27:17 +0000 (06:27 +0000)
When we stop replaying a thread, it moves to the end of its execution
history.  It retains its state from when it was replaying, though, so a
subsequent 'info program' command would show wrong information.

Clear all execution state used by the 'info program' command.

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

index 6308808f4139d0490ef44b0e710f30dac697eadf..bb4952d3349162535e2393d7d189fa374a2b63b6 100644 (file)
@@ -2153,6 +2153,15 @@ record_btrace_stop_replaying (struct thread_info *tp)
   switch (tp->state)
     {
     case THREAD_STOPPED:
+      /* Forget why we stopped; it was at a different location.  */
+      tp->set_stop_reason (TARGET_STOPPED_BY_NO_REASON);
+      tp->set_stop_signal (GDB_SIGNAL_0);
+      tp->control.stop_step = 0;
+
+      if (tp->has_pending_waitstatus ())
+       tp->clear_pending_waitstatus ();
+
+      bpstat_clear (&tp->control.stop_bpstat);
       break;
 
     case THREAD_RUNNING:
index 55b8b5d0b697f08caa5d85a0755354697bfa472f..66d40a8e842c09aabc55b5b63616887dec254f1e 100644 (file)
@@ -51,6 +51,9 @@ with_test_prefix "replay" {
 # Stop recording and try to step live (pr19340).
 with_test_prefix "live" {
     gdb_test "record stop" "Process record is stopped.*fun4\.4.*"
+    gdb_test "info program" [multi_line \
+      "Program stopped at $hex\." \
+      "Type \"info stack\" or \"info registers\" for more information\."]
     gdb_test "reverse-next" "Reverse execution is not currently supported.*"
     gdb_test "step" ".*fun3\.2.*"
 }