From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ofCnEibWKmqOswEAWB0awg (envelope-from ) for ; Thu, 11 Jun 2026 11:37:10 -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=WJCGGiPG; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4419E1E098; Thu, 11 Jun 2026 11:37:10 -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 A21361E070 for ; Thu, 11 Jun 2026 11:37:09 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 501FD4BA23EC for ; Thu, 11 Jun 2026 15:37:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 501FD4BA23EC 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=WJCGGiPG Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by sourceware.org (Postfix) with ESMTPS id 7B48A4BA23CA for ; Thu, 11 Jun 2026 15:34:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B48A4BA23CA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=tempfail smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7B48A4BA23CA Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781192087; cv=none; b=M31HzgWJGuDm9GvwU2NDCW5AremcA47vNkzOlWjp7gItilFZwq5Jjg7NFfIT3AXgA09nbEvUZU6htB5BZ1Cnmi/+FvzP+40807rk2UTrId/85TIN2yADCCg5IZH13+VNyYfPF7yXMfAv04q1uTO0PvsEgkv8drTD64F4NSdDiag= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781192087; c=relaxed/simple; bh=vhoLnmgdGb96fLs+/UCWDEtVp3f2iO86qx9U+F5zVVs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vNJS7v/3EIkuUw3af3KO6H5DfFFszkkf6yXKCcyS4HYzpqwtoG5y/+6tgWTjg1cusHX3NtFzXQ/kMqwCVLuzQS6bggC2qsU9qhAmEWPOdmccJXZDyAyMN++TClX8C3dv8Z3sQ3Uxi00gPWOOqsMkKnh+yLAnglE/D7vdumVfKiA= 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=WJCGGiPG DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B48A4BA23CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781192088; x=1812728088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vhoLnmgdGb96fLs+/UCWDEtVp3f2iO86qx9U+F5zVVs=; b=WJCGGiPGlcbFAafEHH44z6pIGKyPRIrVlNUemsi0AjkpNekFb6M0Zl7h UDe+VS2OmBA9DVcholSSdjLGjAy2/oxIUIuCvR9kiIggrJztaPXQMjycq /KyiTQjVQX0DYWUb6aTKOBM18i9lmTHY8SgBWtfgl1hg5ftzbGyOdLvX5 HIU6Ez5Ui00SyFKG6vxS1rfVBNvke0v8wDCwhuYoCrh9toixZFj1ACcty IZZ5IuhUA/kC6vT0NQfjtsgtaFK1J7tUYqiXnRUceFcFdUe7LYqWkg41F sZkO58UNuDIbozoMeG61JiwXEOh35SgcmL81quew4p5lC8vkftZgwc+34 Q==; X-CSE-ConnectionGUID: wdMBJqiIQt2ljigGgmli4Q== X-CSE-MsgGUID: alYYLfAcRtStyUG0Q243Pg== X-IronPort-AV: E=McAfee;i="6800,10657,11813"; a="104675607" X-IronPort-AV: E=Sophos;i="6.24,199,1774335600"; d="scan'208";a="104675607" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2026 08:34:47 -0700 X-CSE-ConnectionGUID: dqjcPpNBQqCTit6Bo/II+w== X-CSE-MsgGUID: ekOZoNRCQqib9amu4FFooQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,199,1774335600"; d="scan'208";a="246596977" Received: from womilian-mobl.ger.corp.intel.com (HELO localhost) ([10.245.82.28]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2026 08:34:45 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: markus.t.metzger@intel.com, stephan.rohr@intel.com, aburgess@redhat.com, mohamed.bouhaouel@intel.com Subject: [PATCH v2 06/11] gdb, remote: fix ptid matching for process-wide stop events Date: Thu, 11 Jun 2026 17:32:26 +0200 Message-ID: <20260611153232.3011-7-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260611153232.3011-1-mohamed.bouhaouel@intel.com> References: <20260611153232.3011-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 cc0170d922c..d66bfeb02de 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8363,6 +8363,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