From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kZl+L+KbYGpCwCQAWB0awg (envelope-from ) for ; Wed, 22 Jul 2026 06:30:58 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bK+W4h+5; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BCC601E09E; Wed, 22 Jul 2026 06:30:58 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [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 B37ED1E099 for ; Wed, 22 Jul 2026 06:30:57 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 59DAB4BA2E2B for ; Wed, 22 Jul 2026 10:30:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59DAB4BA2E2B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bK+W4h+5 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by sourceware.org (Postfix) with ESMTPS id F38094BA23CC for ; Wed, 22 Jul 2026 10:28:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F38094BA23CC 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 F38094BA23CC Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784716090; cv=none; b=MaswxoMPhidmbmuZ+twLdgypF4g3SExq6yVOvA3L8Gp9iFUuAZ5HE1Hb0UtUxjpqF7ljWkNz9N/DG5gOCtqwOmMkFfYpK1DSRVuZWuX2UsNgI6+qvL4TGiy7qrIWY+JLq65U/QlB0ZTngy7gO2CbNjyZw19Y4MCo2GJbyAWHwn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784716090; c=relaxed/simple; bh=kYNqSeWD2I+AXKFFUYp3mccs+A6urBb0kC4iDFNl948=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=N8rWYV0RryZxYEO//W5riiCRpxDrvyskefuTNh5bL3JriLt7CaD4RHrLbTjEpA7uUTIhnsc07DQTTk+wB1ctlN+uAZwYpfe4rhKiqLTvhI0/synuLC4N2kgNpuaCNdyxzPuKAyY2B9uSStLKRfO4I9s5J0PwNUOLv7sbF4yX354= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bK+W4h+5 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F38094BA23CC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784716090; x=1816252090; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kYNqSeWD2I+AXKFFUYp3mccs+A6urBb0kC4iDFNl948=; b=bK+W4h+5+Hv4CxKzFfus8n/dHKg3V3eIAM6TW5hK2+XLWbIVOggsKHYv /i57uOTzOgrMBEFNwvUT0cvN5x6M07SvS/xnUCp60FZB1WUl0l+kWS/0P cxF5IYE4StbLCA6vKEDvGCOloPQUJujywE3XpA1ZTz76SP1ioLU2rM1lA 4kHQHiqZSD5jiIJp1Kfynm8UepMC7eKlkrS4AMYY395jei0SZI3fW7hbY /ANwKXvjHNAP7T8LvHPuLrZUIjuIh4xqMTpQ7LfcpkjYsGP/wrGovLy/s xHOzicmDDGoqpKqIqLooo23oNpLh5zd3bOxLPhgW5y6LeLIZBWin3n+2j A==; X-CSE-ConnectionGUID: +oMeXJIBRXqWzUX+i8r2Lg== X-CSE-MsgGUID: s0jm9UyOSci/aXLl4Du5dw== X-IronPort-AV: E=McAfee;i="6800,10657,11853"; a="102896193" X-IronPort-AV: E=Sophos;i="6.25,178,1779174000"; d="scan'208";a="102896193" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2026 03:28:09 -0700 X-CSE-ConnectionGUID: MLCk0gRCSNOgU7fTlvIScA== X-CSE-MsgGUID: KAl5gN3HSvi7yXKLY1eccA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,178,1779174000"; d="scan'208";a="258123411" Received: from dut1629dg2frd.igk.intel.com (HELO localhost) ([10.211.178.246]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2026 03:28:07 -0700 From: Klaus Gerlicher To: gdb-patches@sourceware.org Cc: tom@tromey.com, guinevere@redhat.com, eliz@gnu.org Subject: [PATCH v8 1/6] gdb: use schedlock_applies in user_visible_resume_ptid. Date: Wed, 22 Jul 2026 10:27:41 +0000 Message-Id: <20260722102746.131536-2-klaus.gerlicher@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260722102746.131536-1-klaus.gerlicher@intel.com> References: <20260722102746.131536-1-klaus.gerlicher@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 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 --- gdb/infrun.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index c0767e7f764..ace34507cfe 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -108,6 +108,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); static void handle_process_exited (struct execution_control_state *ecs); @@ -2442,20 +2443,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) { @@ -3246,17 +3241,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 Intel Deutschland GmbH Registered Address: Dornacher Strasse 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 Muenchen HRB 186928