]> 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, 26 May 2025 07:01:15 +0000 (07:01 +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.

gdb/infrun.c
gdb/record-full.c

index 0b8728799613ca00806b2aa1008418c83654af9e..dccd72dc308c7fb7e936e9b2d8db6bb196618c69 100644 (file)
@@ -2392,7 +2392,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.  */
@@ -3104,16 +3104,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 b52fb062d80187d399059211ad5708e6dd453061..bec2ffb58f7f22a896f10c8d0e95fb6ab080f3cb 100644 (file)
@@ -2072,7 +2072,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.  */