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>
This commit is contained in:
Markus Metzger
2024-10-25 07:17:05 +00:00
parent 732ed016e2
commit d0844398e2
2 changed files with 6 additions and 7 deletions

View 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)

View 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. */