From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2dcMOSoAVmpWiQcAWB0awg (envelope-from ) for ; Tue, 14 Jul 2026 05:23:54 -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=FgzQg5b8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DC5F51E099; Tue, 14 Jul 2026 05:23:54 -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 DFA661E099 for ; Tue, 14 Jul 2026 05:23:53 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BA004BA2E25 for ; Tue, 14 Jul 2026 09:23:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BA004BA2E25 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=FgzQg5b8 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by sourceware.org (Postfix) with ESMTPS id 8A0E84BA23C6 for ; Tue, 14 Jul 2026 09:22:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A0E84BA23C6 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 8A0E84BA23C6 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=1784020937; cv=none; b=iyQCTPlgv2bcPTpBzHkejBCj0YkwjPMubQya/TFGPP63/p73N21r6a2DvnysfkIjfp+Z4kXOaAFKIDh18iomZIJbfxKC7aDlSlZe4l7ECqGRJmoL41IpUecbzTE+64ggslLgoGC91U+LfQA1D3PyfpU1ehWtG26rVK/dLsidHjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784020937; c=relaxed/simple; bh=ltt+RPt90z59Y6Y7KA5fC65ACOPe/HLe9HxNeK+QL8A=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ghdNFqlpU5B3E4J7v902a4++VaghSKWWuWh6o6yprzf1yWd7b72mtmpeFxvX+2w/WN4CYP+n8ZWdYa80s0jvPaQsTkO1T+tUD/tpjsORkuhVpnNx15/+twkVzU9RU8/WCFoXOQ9YXdiZjxd98CLV/b9oS5giR8ZMxTVPrtMMSoE= 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=FgzQg5b8 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A0E84BA23C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784020938; x=1815556938; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ltt+RPt90z59Y6Y7KA5fC65ACOPe/HLe9HxNeK+QL8A=; b=FgzQg5b8X6RmmE/PZTZlhQ2BgDCFAj7ayVUPuWmu9XR9yFcUA4ds5s4d lleeOT8eRSEhMiuTkpekxmNaciIx52gyce7jAdxfhhzXwyZQVGOtAsuHw eLUFRigTIMyK7ovAsm2ZXFS7gvKV7BWoibT7PwPjJxpK3vxUhceNeqU7N 67EOu+FsNtv7RHP1QZZH+gYaUhywUahEFXepNOM2llrIVeo5VTrORqOCA 8AzNISyTDlFaxDU8DfVNDFpV/Dh2e27SYPznZRc3musRnUG/qf0+5i66/ VcNA5Bzh3G6/Am5mMlfj1uskM89r4brtrzy0/z8Cap5Rd5O1lWPBT8bB9 A==; X-CSE-ConnectionGUID: bwTsKxX7S4Oiq1Ge4RnrPg== X-CSE-MsgGUID: n3osRzx6TLme/wA5VmDtLQ== X-IronPort-AV: E=McAfee;i="6800,10657,11846"; a="95284628" X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="95284628" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 02:22:17 -0700 X-CSE-ConnectionGUID: rQkTPM1bT/iU+0Dbc8oSwg== X-CSE-MsgGUID: tlf4uZB7T32Jws/gBSNb1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="254679426" Received: from sguenant-mobl2.ger.corp.intel.com (HELO localhost) ([10.246.18.94]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 02:22:15 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: markus.t.metzger@intel.com, stephan.rohr@intel.com, eliz@gnu.org, aburgess@redhat.com, pedro@palves.net Subject: [PATCH v4 06/11] gdb, remote: fix ptid matching for process-wide stop events Date: Tue, 14 Jul 2026 11:21:23 +0200 Message-ID: <20260714092128.12941-7-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260714092128.12941-1-mohamed.bouhaouel@intel.com> References: <20260714092128.12941-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 b27b1a1b6c0..b1bc1283b9a 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