From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QcoyJ/lLg2l6ICgAWB0awg (envelope-from ) for ; Wed, 04 Feb 2026 08:39:05 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=THv+mkVD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9CC321E08D; Wed, 04 Feb 2026 08:39:05 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED,RDNS_NONE autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (unknown [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EA53A1E08D for ; Wed, 04 Feb 2026 08:39:04 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 7B2414BA2E17 for ; Wed, 4 Feb 2026 13:39:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B2414BA2E17 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=THv+mkVD Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by sourceware.org (Postfix) with ESMTPS id 512484BA2E0A for ; Wed, 4 Feb 2026 13:38:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 512484BA2E0A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 512484BA2E0A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770212302; cv=none; b=VCuV+xEdoxP83e3CzbkFhnd/EH8hPbhCZcSATf4uS3qx2sPd5SFfnxX2QLd/cZWB1I51n3lWwmnymfbzRMUkjAWv4JUkHnvPUgBZ9PVYTXifUsF3ockz7Ypyomk+8Xa+dE2ZxiFVws2Eob6jdZeSvJry8toOn4N6tklBSBZaoQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770212302; c=relaxed/simple; bh=yhMwh1rOKKt0ah74dki9gAqpl6w1cYFiGpEueGYzkaU=; h=DKIM-Signature:MIME-Version:From:To:Subject:Date:Message-Id: MIME-Version; b=NYI2mUnHk6sxCO9deRk+wCPeUQk2ny8mWJdOz+pLXZ9ceeS2uvzKVg7NUWJ+d6fdq6HkzEX39wu/LtmIYr0GCxmCMwhdP0xO9CJQtMbr1eWim8UNuD5frZYgv5FK6ib7SeshnUtv1LGZRYnITLyeY86JdRVAPkWzWplzvWKZuXQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 512484BA2E0A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770212303; x=1801748303; h=from:to:subject:date:message-id:in-reply-to:references; bh=yhMwh1rOKKt0ah74dki9gAqpl6w1cYFiGpEueGYzkaU=; b=THv+mkVDlB+kI6Pa2bFkTidpUvCVjbS4VqEW0VDePfNjcnarglckSjBL cD9HjgrAT5Ig4G0jxUDkaWvR2IoysOXzACxFRPTXJn8u8zMSQsaVUi0SO YxtWA4GyBxQSht8Mj4dCs6Yb/Ih0tK7JGEbCQhfmvspfAHed0fUR3gYA0 og7pPJ72vHFgrmVkB4SLSFxqhaDGWyEQGVwc4pX4a2idXuItpz/WXzP4q y8XV16agd5Tm3GPvuu4XB551T8vf6nEHTCZany82Mm1pwMwTA39SPdUhb CY5mmtJM+F9O3ot+81rv+imzu5+xSQ2hrLsVWdtToh/6p1FCQ2/0Pncu2 A==; X-CSE-ConnectionGUID: E34NjkLXTLy/SI8wxuF4HA== X-CSE-MsgGUID: 6oV+t9yXS4eLqp6w7p3YsA== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="74001366" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="74001366" Content-Type: multipart/mixed; boundary="===============2497485569296442294==" MIME-Version: 1.0 Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 05:38:22 -0800 X-CSE-ConnectionGUID: hdECSB+3S660GtyWdk7Lcg== X-CSE-MsgGUID: V3NNtytfRoWopoB+hV4ikw== X-ExtLoop1: 1 Received: from dut1865dg2frd.igk.intel.com (HELO localhost) ([10.211.179.243]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 05:38:21 -0800 From: Klaus Gerlicher To: gdb-patches@sourceware.org Subject: [PATCH v6 1/6] gdb: use schedlock_applies in user_visible_resume_ptid. Date: Wed, 4 Feb 2026 13:37:48 +0000 Message-Id: <20260204133753.547281-2-klaus.gerlicher@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260204133753.547281-1-klaus.gerlicher@intel.com> References: <20260204133753.547281-1-klaus.gerlicher@intel.com> MIME-Version: 1.0 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org --===============2497485569296442294== Content-Transfer-Encoding: 8bit From: Natalia Saiapova This is a refactoring. The logic in user_visible_resume_ptid is very similar to schedlock_applies, but uses `step` and `record_will_replay` parameter instead of `tp->control.stepping_command`. Refactor schedlock_applies logic into the following two overloaded methods: bool schedlock_applies (thread_info *tp) and bool schedlock_applies (bool step, bool record_will_replay) such that they share the logic. Update the call-sites accordingly, where we have only the thread, use the former, and where we have the bool step or record_will_replay use the latter. Approved-By: Tom Tromey your changes. Lines starting --- gdb/infrun.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 6bcd8ec5cc0..ba360570d48 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -107,6 +107,7 @@ static bool start_step_over (void); static bool step_over_info_valid_p (void); static bool schedlock_applies (struct thread_info *tp); +static bool schedlock_applies (bool step, bool record_will_replay); /* Asynchronous signal handler registered as event loop source for when we have pending events ready to be passed to the core. */ @@ -2390,20 +2391,14 @@ user_visible_resume_ptid (int step) individually. */ resume_ptid = inferior_ptid; } - else if ((scheduler_mode == schedlock_on) - || (scheduler_mode == schedlock_step && step)) + else if (schedlock_applies (step, + target_record_will_replay (inferior_ptid, + execution_direction))) { /* User-settable 'scheduler' mode requires solo thread resume. */ resume_ptid = inferior_ptid; } - else if ((scheduler_mode == schedlock_replay) - && target_record_will_replay (inferior_ptid, execution_direction)) - { - /* User-settable 'scheduler' mode requires solo thread resume in replay - mode. */ - resume_ptid = inferior_ptid; - } else if (inferior_ptid != null_ptid && inferior_thread ()->control.in_cond_eval) { @@ -3191,17 +3186,32 @@ thread_still_needs_step_over (struct thread_info *tp) return what; } +/* Returns true if scheduler locking applies to TP. */ + +static bool +schedlock_applies (thread_info *tp) +{ + bool step = false; + bool record_will_replay = false; + if (tp != nullptr) + { + step = tp->control.stepping_command; + record_will_replay + = target_record_will_replay (tp->ptid, execution_direction); + } + return schedlock_applies (step, record_will_replay); +} + /* Returns true if scheduler locking applies. STEP indicates whether - we're about to do a step/next-like command to a thread. */ + we're about to do a step/next-like command and RECORD_WILL_REPLAY + indicates whether we're about to replay. */ static bool -schedlock_applies (struct thread_info *tp) +schedlock_applies (bool step, bool record_will_replay) { return (scheduler_mode == schedlock_on - || (scheduler_mode == schedlock_step - && tp->control.stepping_command) - || (scheduler_mode == schedlock_replay - && target_record_will_replay (tp->ptid, execution_direction))); + || (scheduler_mode == schedlock_step && step) + || (scheduler_mode == schedlock_replay && record_will_replay)); } /* When FORCE_P is false, set process_stratum_target::COMMIT_RESUMED_STATE -- 2.34.1 --===============2497485569296442294== Content-Type: multipart/alternative; boundary="===============4664966776561998451==" MIME-Version: 1.0 Content-Disposition: inline --===============4664966776561998451== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Intel Deutschland GmbH Registered Address: Dornacher Stra=C3=9Fe 1, 85622 Feldkirchen, Germany Tel: +49 89 991 430, www.intel.de Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell Chairperson of the Supervisory Board: Nicole Lau Registered Seat: Munich Commercial Register: Amtsgericht M=C3=BCnchen HRB 186928 --===============4664966776561998451== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable
Intel Deutschland GmbH
Registered Address: Dornacher Stra=C3= =9Fe 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.deManaging Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell<= div>Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: M= unich
Commercial Register: Amtsgericht M=C3=BCnchen HRB 186928 --===============4664966776561998451==-- --===============2497485569296442294==--