]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
btrace, infrun: simplify scheduler-locking replay
authorMarkus Metzger <markus.t.metzger@intel.com>
Fri, 25 Oct 2024 07:17:05 +0000 (07:17 +0000)
committerMarkus Metzger <markus.t.metzger@intel.com>
Mon, 3 Nov 2025 06:31:51 +0000 (06:31 +0000)
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>
gdb/infrun.c
gdb/record-full.c

index 81764e6b1a2a373291004c69ff7da665e4c3700b..99362fe09e969e2d925745c77dfc946f63a838c3 100644 (file)
@@ -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)
index ff45fcf03435a122fd65a14f0a1436f2494a0cfe..15d2435ba3c9f8c9a16e58be656b7404e2f1b3ef 100644 (file)
@@ -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.  */