From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EW54LJmmnmqp6jMAWB0awg (envelope-from ) for ; Mon, 07 Sep 2026 07:57:13 -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=koaaryB/; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B22FA1E09E; Mon, 07 Sep 2026 07:57:13 -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 10AEC1E091 for ; Mon, 07 Sep 2026 07:57:13 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88CA74BA2E2E for ; Mon, 7 Sep 2026 11:57:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88CA74BA2E2E 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=koaaryB/ Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by sourceware.org (Postfix) with ESMTPS id 80A294BC7ED0 for ; Mon, 7 Sep 2026 11:55:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80A294BC7ED0 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 80A294BC7ED0 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788782147; cv=none; b=wbHZWPT1/fw8mjh/vjvxJn3E6Q0AtVQkNNNltfVqhZEtWYa3EMzKmWGk7gntp5igoOxIdFEf29TTTXYd6FOGMXLruF+Qclm041qCY6pZ0aNlYDWkh+LZ9ivnRZUFH/kelyw6afzl3LmbcC8DvICiBSihXSFdmEj/cOMh/b8Q2AA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788782147; c=relaxed/simple; bh=s0YvE7U9Uwm+dHpPqCf6vkTwD4u6RjioWO0JMAPJ05U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=FJvDlQu+IFMPejO3ncOd7PsyAnK0yu/yKbxOdGPuhtpbDAUeE54hxytl6KZwMsfTi1Y3Mx0WI6SrhVNI9scK7fU2Tnq4jQ+b18aLZCDF+TQ9yeRGzGHXl7IFdVBn8Zx2OCv97eAEhmDUbLL9FEu5w6D5cndB8vTMJfKxXJHa97g= 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=koaaryB/ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 80A294BC7ED0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1788782148; x=1820318148; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s0YvE7U9Uwm+dHpPqCf6vkTwD4u6RjioWO0JMAPJ05U=; b=koaaryB/N/t1TK/WfXrq4k2fG/wjZcE4v/fEJ96ujKK++kKW3RhXsRgA oqqtpQ4NsZpSXlOrdhiQo8+sXtzk0jWMxgjBdTdiTEwql458Au6nS63Wz aaseBPeQfYlHJFUslgbPvyf/vDKzAr6zW+9P4S00dlz+U/HQjL2dBSbUq 3J7QVewF57+h5e6Lmx4p9uDQldD+kMY2sbvi288AcFPwd6rLHvOHGRcdl 4Kd+MvA4rx62dCrcaArDI0pBxBWKMXgAcCniAoGKKKH1P35p8VPKNdIeO 0RM5LsrqDlSmsr0rGdzWBsTP6vLE9ppc1zolRthJAJrPjz3fOJ4cyJIlL g==; X-CSE-ConnectionGUID: c8ydamSASGiNTkZSPRUO+w== X-CSE-MsgGUID: /DjDpC4SSkKA+vkKztJamQ== X-IronPort-AV: E=McAfee;i="6800,10657,11898"; a="99517477" X-IronPort-AV: E=Sophos;i="6.25,267,1779174000"; d="scan'208";a="99517477" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2026 04:55:47 -0700 X-CSE-ConnectionGUID: L9Gtm6ZuRHq+O5WEiJwoWA== X-CSE-MsgGUID: GbJrqKhSRaWVGmh72hHo3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,267,1779174000"; d="scan'208";a="264496074" Received: from dut1583dg2frd.igk.intel.com (HELO localhost) ([10.211.179.243]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2026 04:55:45 -0700 From: Klaus Gerlicher To: gdb-patches@sourceware.org Cc: tom@tromey.com, aburgess@redhat.com, eliz@gnu.org, guinevere@redhat.com Subject: [PATCH v9 1/6] gdb: use schedlock_applies in user_visible_resume_ptid. Date: Mon, 7 Sep 2026 11:55:32 +0000 Message-Id: <20260907115537.307049-2-klaus.gerlicher@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260907115537.307049-1-klaus.gerlicher@intel.com> References: <20260907115537.307049-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 Approved-By: Andrew Burgess --- gdb/infrun.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index b9618fb6422..cf072237f48 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -107,7 +107,8 @@ 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 (thread_info *tp); +static bool schedlock_applies (bool step, bool record_will_replay); static void handle_process_exited (struct execution_control_state *ecs); @@ -2443,20 +2444,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) { @@ -3247,17 +3242,28 @@ thread_still_needs_step_over (struct thread_info *tp) return what; } +/* Returns true if scheduler locking applies to non-NULL thread TP. */ + +static bool +schedlock_applies (thread_info *tp) +{ + gdb_assert (tp != nullptr); + bool step = tp->control.stepping_command; + bool 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) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.