From: Markus Metzger Date: Fri, 25 Oct 2024 07:17:05 +0000 (+0000) Subject: btrace, infrun: simplify scheduler-locking replay X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=252498d88273f65758c069c164e31cd310439d41;p=thirdparty%2Fbinutils-gdb.git 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. --- diff --git a/gdb/infrun.c b/gdb/infrun.c index 0b872879961..dccd72dc308 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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) diff --git a/gdb/record-full.c b/gdb/record-full.c index b52fb062d80..bec2ffb58f7 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -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. */