From: Markus Metzger Date: Tue, 12 Aug 2025 12:33:48 +0000 (+0000) Subject: btrace: clear thread stopped state when stopping replaying X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=add41f3be2942f5bb0477ce124167b3ff8c151d9;p=thirdparty%2Fbinutils-gdb.git btrace: clear thread stopped state when stopping replaying 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. --- diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 6308808f413..bb4952d3349 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -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: diff --git a/gdb/testsuite/gdb.btrace/step.exp b/gdb/testsuite/gdb.btrace/step.exp index 55b8b5d0b69..66d40a8e842 100644 --- a/gdb/testsuite/gdb.btrace/step.exp +++ b/gdb/testsuite/gdb.btrace/step.exp @@ -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.*" }