From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OaGsFYF2fGpIlCAAWB0awg (envelope-from ) for ; Wed, 12 Aug 2026 09:34:57 -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=KQQNDiVT; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 528C71E09E; Wed, 12 Aug 2026 09:34:57 -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 [IPv6:2620:52:6:3111::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 3DFD71E09E for ; Wed, 12 Aug 2026 09:34:55 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D619A4BB3B81 for ; Wed, 12 Aug 2026 13:34:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D619A4BB3B81 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=KQQNDiVT Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by sourceware.org (Postfix) with ESMTPS id 405BE4B9DB5D for ; Wed, 12 Aug 2026 13:29:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 405BE4B9DB5D 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 405BE4B9DB5D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786541363; cv=none; b=hHS443+hnHVnwgLBQ6qihZcN0PB7s/2IP30Z5AveBqFpYxqUPsGVdtsz9HxHWPZqeOWGrNj9Yx14wyVoiGQhPlVsdTGMPqBgyKQGjO1+3YLNopBXHgwXTkXYKG2v0PZbRhdya5mAkAj9U1/T8qjH3rxmJxfSf8UOAR3Ierp/hfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786541363; c=relaxed/simple; bh=ioofoFMZaWkn4jqi4cWJ7i5WNFoNqVxob+8ol9p+OBw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=W1tgxHmQIyNhGJpo4MLFL4dbp1jc+2lACkj4aEeV0aelFG1B6syv/YXYviM0n7jKFpwVFlXXiDSLVrAT37v4wStnUqJChztu3DZQb+qlclF1/0aSWYml78YgGNhoWe5e+IFzO97KLmaIRqRB6jcBqWMMdX1cPK96fRnoJ91Bchs= 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=KQQNDiVT DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 405BE4B9DB5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1786541363; x=1818077363; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ioofoFMZaWkn4jqi4cWJ7i5WNFoNqVxob+8ol9p+OBw=; b=KQQNDiVTtqQzbH0+2RCpOllHsmC4Fp/1pRDIN7mjTZSJw+p+oiFLGda9 JEbAo+eCV3azi7J6bzOfblrQ+hcyKMjmS+xw18dj6lK0cA2TcVK3MUkLu cTalvAmREEK17qHfbeKWpB9RscEF5JWYi/k/OHM0lPHy8R0osOSk9g6NI sYt4A0qPG5+3hYSU9l2aebjNTR/nhEuqEWxBt8x3LeP6kP/E4VlXCRsnX pA40sLxOZrIFHeMiBKo+ELh9OFb7B5AC4xuFGoKVpPRJ0G7pzXqXdVrHY EN8RKDa6+JFNz7ttBH8k9dtKReIRWwSAe2ZnQwnki86R81gRE7rPQmfbE Q==; X-CSE-ConnectionGUID: iHdAvQ2UQKGy3+Gdx5nINQ== X-CSE-MsgGUID: TtouNL/qQB6G64xsZaA9EA== X-IronPort-AV: E=McAfee;i="6800,10657,11872"; a="97757868" X-IronPort-AV: E=Sophos;i="6.25,219,1779174000"; d="scan'208";a="97757868" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2026 06:29:22 -0700 X-CSE-ConnectionGUID: h8zmgsjfQ6uQQYQTm73xlg== X-CSE-MsgGUID: 8AwrGYb3Rc2w617+wYKZpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,219,1779174000"; d="scan'208";a="259817930" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2026 06:29:21 -0700 From: Markus Metzger To: gdb-patches@sourceware.org Subject: [PATCH v4 24/44] gdb: allow resuming an inferior with no threads Date: Wed, 12 Aug 2026 15:27:44 +0200 Message-ID: <20260812132805.380163-25-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260812132805.380163-1-markus.t.metzger@intel.com> References: <20260812132805.380163-1-markus.t.metzger@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 When resuming an inferior without threads and schedule-multiple, we may end up resuming threads of other inferiors in all-stop mode. Clear their proceed status so we do not report the same event again. Also, simplify clear_proceed_status () by collapsing the all-stop and non-stop cases. In non-stop, user_visible_resume_ptid () returns inferior_ptid, so iterating over all non-exited threads matching that ptid in all-stop mode matches calling clear_proceed_status_thread () for inferior_thread () in non-stop mode. --- gdb/infrun.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index c0767e7f764..ce7c376af14 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3173,32 +3173,29 @@ clear_proceed_status (int step, bool about_to_proceed) && !target_record_will_replay (inferior_ptid, execution_direction)) target_record_stop_replaying (); - if (!non_stop && inferior_ptid != null_ptid) - { - ptid_t resume_ptid = user_visible_resume_ptid (step); - process_stratum_target *resume_target - = user_visible_resume_target (resume_ptid); + ptid_t resume_ptid = user_visible_resume_ptid (step); + process_stratum_target *resume_target + = user_visible_resume_target (resume_ptid); - /* In all-stop mode, delete the per-thread status of all threads - we're about to resume, implicitly and explicitly. */ - for (thread_info &tp : all_non_exited_threads (resume_target, resume_ptid)) - if (tp.internal_state () != THREAD_INT_RUNNING) - clear_proceed_status_thread (&tp); - } + if (resume_ptid == null_ptid) + return; - if (inferior_ptid != null_ptid) + /* Delete the per-thread status of all threads we're about to resume, + implicitly and explicitly. */ + for (thread_info &tp : all_non_exited_threads (resume_target, resume_ptid)) + if (tp.internal_state () != THREAD_INT_RUNNING) + clear_proceed_status_thread (&tp); + + for (inferior *inf : all_non_exited_inferiors (resume_target)) { - struct inferior *inferior; + if (!inf->has_execution ()) + continue; - if (non_stop) - { - /* If in non-stop mode, only delete the per-thread status of - the current thread. */ - clear_proceed_status_thread (inferior_thread ()); - } + ptid_t ptid { inf->pid }; + if (!ptid.matches (resume_ptid)) + continue; - inferior = current_inferior (); - inferior->control.stop_soon = NO_STOP_QUIETLY; + inf->control.stop_soon = NO_STOP_QUIETLY; } if (about_to_proceed) -- 2.43.0 ________________________________________ 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.