From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +fdoJC6cS2pKvCkAWB0awg (envelope-from ) for ; Mon, 06 Jul 2026 08:14:38 -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=QsvFT2RF; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 910871E098; Mon, 06 Jul 2026 08:14:38 -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 318D41E070 for ; Mon, 06 Jul 2026 08:14:38 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E2784BA2E16 for ; Mon, 6 Jul 2026 12:14:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E2784BA2E16 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=QsvFT2RF Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by sourceware.org (Postfix) with ESMTPS id 209BE4BA2E18 for ; Mon, 6 Jul 2026 12:13:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 209BE4BA2E18 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 209BE4BA2E18 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783340000; cv=none; b=wLdvEDzzXgfF1W5o8s87Q8L3NIYI3jKFVKiQTCNpRBg4La/u1vXGrJ8l798KOAIrgUTyTHkqLjjQlYyNn+xMwPJ0BO9hEKmbLafau37EsTosNbt1Gsj4N0ZQ871LgnqiHaosVhv+NrGC+DCLQKV0Bzo904fq9/4znvH+CLLChfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783340000; c=relaxed/simple; bh=7a7HxsBp7CmsXg5B9EmvhIC8LT2wZe4caUvyUpUri8k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jKp60NtNcOVPg7an6tbkdyS85bOHPZMtDivCOyVg64WxOBR08diYonM+h6tHF30vcsJCjjKYkjtAFEEpd+3p9uoXQK0EkmuyLJcr3Vvd7oUhWHDN81o5YpZhD2zKg/Bgc1qSShaWwLCyfWO+xnEoFJ5Rt6yIAQZT2St310nJSKQ= 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=QsvFT2RF DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 209BE4BA2E18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783340000; x=1814876000; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7a7HxsBp7CmsXg5B9EmvhIC8LT2wZe4caUvyUpUri8k=; b=QsvFT2RFqOrtNIeKjLpEkIv/5/xOzlkaNYjjIVItB8wKP6GEHgrzCG8a 0kgF7Yy+oJubk3sRi+1sZ+KRDNgSCMOaxT34ff1BgiaG6l10G/OL/VQt0 Tp1TVQVvcDSwyCtjlw5jDysXPsPo97pidSOYvmkVQI8rzxOvUhVKd+P8Z Qa9Bu+YKuUVursE+0iBBAY8vXU/JgXS2ecD4B8fmV28zlq1R0jqvplq37 wNMb9yQ01LsdtKWlRla0Os+OQEI7DvJJwJNk8o+7w0NOXicBU0EZyylgV RPbOi9eUq/9MlW/nHT7Ya00jxvpG5hNYsfNm7glD2lRUzCkiQzfC0Acfo Q==; X-CSE-ConnectionGUID: Z0mTAiIpTrGPEw2PicC1mw== X-CSE-MsgGUID: wR+ZNuLoTa29vgm7pABDdQ== X-IronPort-AV: E=McAfee;i="6800,10657,11838"; a="95349747" X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="95349747" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:13:19 -0700 X-CSE-ConnectionGUID: 23q2xPBES6O6lNryrUVAOA== X-CSE-MsgGUID: JlYQAkEGTH6xTzF94jrIhg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="253232022" Received: from unknown (HELO localhost) ([10.245.114.180]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:13:17 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: stephan.rohr@intel.com, markus.t.metzger@intel.com, pedro@palves.net, aburgess@redhat.com Subject: [PATCH v3 06/11] gdb, remote: fix ptid matching for process-wide stop events Date: Mon, 6 Jul 2026 14:11:19 +0200 Message-ID: <20260706121124.18784-7-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706121124.18784-1-mohamed.bouhaouel@intel.com> References: <20260706121124.18784-1-mohamed.bouhaouel@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: "Rohr, Stephan" If an inferior call results in a process event for a non-stop remote target, GDB does not properly handle the event but is hanging. Because GDB is evaluating a breakpoint condition, the corresponding inferior call is evaluated w.r.t. the ptid of the current thread. gdbserver sends a process exit event; the event is not matched by the thread PTID and GDB hangs. Fix this by matching a process event in 'stop_reply_queue' if there is no matching thread event. This ensures a thread event is prioritized if both a thread event and a process event are queued and preserves the current behavior. Reproducible when running gdb.base/exit-in-condition.exp, on native-extended-gdbserver with target-non-stop enabled. export GDBFLAGS="-iex \"maint set target-non-stop on\"" make check TESTS="gdb.base/exit-in-condition.exp" \ RUNTESTFLAGS="--target_board=native-extended-gdbserver GDBFLAGS='$GDBFLAGS'" --- gdb/remote.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdb/remote.c b/gdb/remote.c index 323edd6cb0f..7e3537b99df 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8303,6 +8303,20 @@ remote_target::remote_notif_remove_queued_reply (ptid_t ptid) { return event->ptid.matches (ptid); }); + + /* Match process events if PTID is a thread and there is no matching event + queued. Prioritize thread events to preserve the existing behavior. */ + if (iter == rs->stop_reply_queue.end () + && ptid != minus_one_ptid + && !ptid.is_pid ()) + iter = std::find_if (rs->stop_reply_queue.begin (), + rs->stop_reply_queue.end (), + [=] (const stop_reply_up &event) + { + return (event->ptid.is_pid () + && event->ptid.pid () == ptid.pid ()); + }); + stop_reply_up result; if (iter != rs->stop_reply_queue.end ()) { -- 2.43.0 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