[binutils-gdb] btrace, infrun: simplify scheduler-locking replay
Markus Metzger
mmetzger@sourceware.org
Mon Nov 3 06:41:11 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d0844398e2b31632a6a486fc7f103d47d50fb4e4
commit d0844398e2b31632a6a486fc7f103d47d50fb4e4
Author: Markus Metzger <markus.t.metzger@intel.com>
Date: Fri Oct 25 07:17:05 2024 +0000
btrace, infrun: simplify scheduler-locking replay
When scheduler-locking is set to replay and we're resuming a thread at the
end of its execution history, we check whether anything is replaying in
user_visible_resume_ptid() only to check again in clear_proceed_status()
before we stop replaying the current process.
What really matters is whether the selected thread is replaying or will
start replaying.
Simplify this by removing redundant checks.
Also avoid a redundant pass over all threads to check whether anything is
replaying before stopping replaying. Make record_stop_replaying() handle
the case when we're not replaying gracefully.
Approved-By: Tom Tromey <tom@tromey.com>
Diff:
---
gdb/infrun.c | 10 ++++------
gdb/record-full.c | 3 ++-
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 81764e6b1a2..99362fe09e9 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2397,7 +2397,7 @@ user_visible_resume_ptid (int step)
resume_ptid = inferior_ptid;
}
else if ((scheduler_mode == schedlock_replay)
- && target_record_will_replay (minus_one_ptid, execution_direction))
+ && target_record_will_replay (inferior_ptid, execution_direction))
{
/* User-settable 'scheduler' mode requires solo thread resume in replay
mode. */
@@ -3109,16 +3109,14 @@ notify_about_to_proceed ()
void
clear_proceed_status (int step)
{
- /* With scheduler-locking replay, stop replaying other threads if we're
- not replaying the user-visible resume ptid.
+ /* With scheduler-locking replay, stop replaying other threads in the
+ same process if we're not replaying the selected thread.
This is a convenience feature to not require the user to explicitly
stop replaying the other threads. We're assuming that the user's
intent is to resume tracing the recorded process. */
if (!non_stop && scheduler_mode == schedlock_replay
- && target_record_is_replaying (minus_one_ptid)
- && !target_record_will_replay (user_visible_resume_ptid (step),
- execution_direction))
+ && !target_record_will_replay (inferior_ptid, execution_direction))
target_record_stop_replaying ();
if (!non_stop && inferior_ptid != null_ptid)
diff --git a/gdb/record-full.c b/gdb/record-full.c
index ff45fcf0343..15d2435ba3c 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2074,7 +2074,8 @@ record_full_base_target::goto_record (ULONGEST target_insn)
void
record_full_base_target::record_stop_replaying ()
{
- goto_record_end ();
+ if (RECORD_FULL_IS_REPLAY)
+ goto_record_end ();
}
/* "resume" method for prec over corefile. */
More information about the Gdb-cvs
mailing list