From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id SdBLHjxcC2q97QUAWB0awg (envelope-from ) for ; Mon, 18 May 2026 14:36:44 -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=CYKyrtQI; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 762391E090; Mon, 18 May 2026 14:36:44 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.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,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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 D77E91E024 for ; Mon, 18 May 2026 14:36:43 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 735C84BA9017 for ; Mon, 18 May 2026 18:36:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 735C84BA9017 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=CYKyrtQI Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by sourceware.org (Postfix) with ESMTPS id 86E2F4BABF3D for ; Mon, 18 May 2026 18:35:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 86E2F4BABF3D 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 86E2F4BABF3D 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=1779129356; cv=none; b=OhKALYRtVmGxiiPnPqBDJ30OqOtPZ61ECGbZFnFzcokmD0fEoO3CxnBvn4UiaTJ3Unvh92kGarJM+YXIfedJ6t6rBZRtpIzmck7PbKoiokbj7gqvIHNQr+vskMkZGqavmWJHkYgnT8sb3lmrb9v54jWg8ieKYxKb6Aak2Bwqk5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129356; c=relaxed/simple; bh=VBOuO662BUnG380OoGAhS8YNSnw94+BMju6fl+eZFvc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ANUD2pCQvIlnd1XVymA7ClrYVhlxlTBnklJe92ZJi2HtIQKTt3JtN47M6q0xK5bSEdyUGhRE9yMPHGXNwhfDCKPBcUzID3+wnAgd33EAyYcrSmfz29yEjmInH+osXdziMDcAeufMGBgjPICVi58nfJfjSqfw6O1YK7mMvkwcElw= 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=CYKyrtQI DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86E2F4BABF3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129357; x=1810665357; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VBOuO662BUnG380OoGAhS8YNSnw94+BMju6fl+eZFvc=; b=CYKyrtQICd3SBqeCjCZ7QUBjBOZMYWf4eMslk6LH1g0YvEsNzk41uFfO ldF9Kq7EU4iFUSfrbK/6s0cLpDPSM5rXwO6qw4no6/R/obZ+rCymieB+0 vNPR3lvSGT5aujoiqD7AQruu7CLFQIou283X8SEuiPVbzPx1+Ojfc+IOe LKUOmCtrRTuCNe/s/jCveMo47OqeHCHBgCl1SSYUPdL/105Ih8zVrTuld g1jvEMDSmmKv4t1yp91SSY10d/qsjO5YKaPbxoAC3kg/e4lGKKLXJ/BWE Q3gnUJmerQythbgk5OOEYKHcBAe40eyN+xtg0MivKC/KoqL88RtWU9Axk A==; X-CSE-ConnectionGUID: DwmXjWZzThmT3StnsrFhyA== X-CSE-MsgGUID: 4vIqJZK+SPaH8zENBq12AA== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="90690511" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="90690511" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:56 -0700 X-CSE-ConnectionGUID: DbAJjnvZSFuQxlhdq8VTfQ== X-CSE-MsgGUID: k1oooPQfQJCMdYZvuQwr3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="239584707" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:54 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 09/11] gdb, testsuite: update attach-deleted-exec.exp to handle async messages Date: Mon, 18 May 2026 20:33:05 +0200 Message-ID: <20260518183316.127043-10-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-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: "Bouhaouel, Mohamed" With non-stop targets, async thread notifications can appear between output lines during attach. Also, multiple "Reading symbols from" messages are printed, so we need to specifically match the /proc/ path to capture the correct filename. Output example on a non-stop remote target: (gdb) attach 33604 Attaching to process 33604 [New Thread 33604.33604 (id 1)] Reading symbols from /proc/33604/exe... Reading symbols from /lib/x86_64-linux-gnu/libc.so.6... Reading symbols from /usr/lib/debug/.build-id/8e/9fd827446c24067541ac5390e6f527fb5947bb.debug... Reading symbols from /lib64/ld-linux-x86-64.so.2... Reading symbols from /usr/lib/debug/.build-id/da/07864eb4c1b06504b8688d25d7e84759fe708d.debug... [Switching to Thread 33604.33604] 0x00007c9166eeca7a in __GI___clock_nanosleep ... --- .../gdb.base/attach-deleted-exec.exp | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/gdb.base/attach-deleted-exec.exp b/gdb/testsuite/gdb.base/attach-deleted-exec.exp index 61ee8647c9c..71b1788a283 100644 --- a/gdb/testsuite/gdb.base/attach-deleted-exec.exp +++ b/gdb/testsuite/gdb.base/attach-deleted-exec.exp @@ -45,26 +45,29 @@ clean_restart # Attach. GDB should spot that the executable is gone and fallback to # use /proc/PID/exe. -set test "attach to process with deleted executable" -set re \ - [multi_line \ - "Attaching to process $decimal" \ - "Reading symbols from (\[^\r\n\]+)[string_to_regexp ...]" \ - ".*"] -set filename "" -gdb_test_multiple "attach $testpid" $test { - -re -wrap $re { - set filename $expect_out(1,string) - pass $gdb_test_name +set attached_pid "no pid" +gdb_test_multiple "attach $testpid" "attach to process with deleted executable" { + -re "Attaching to process $decimal\r\n" { + exp_continue + } + -re "\\\[New Thread \[^\r\n\]+\\\]\r\n" { + # Non-stop targets may emit async thread notifications. + exp_continue + } + -re "Reading symbols from /proc/($decimal)/exe[string_to_regexp ...]" { + set attached_pid $expect_out(1,string) + exp_continue + } + -re "Reading symbols from (\[^\r\n\]+[string_to_regexp /.nfs]\[^\r\n\]*)[string_to_regexp ...]" { + unsupported $gdb_test_name + return + } + -re "Reading symbols from \[^\r\n\]+[string_to_regexp ...]\r\n" { + exp_continue + } + -re -wrap "" { + gdb_assert { $attached_pid == $testpid } $gdb_test_name } -} - -set test "filename /proc/PID/exe" -set re_nfs \[^\r\n\]+[string_to_regexp /.nfs]\[^\r\n\]+ -if { [regexp $re_nfs $filename] } { - unsupported $test -} else { - gdb_assert { [string equal $filename /proc/${testpid}/exe] } $test } # Restart GDB. @@ -99,12 +102,18 @@ if { [target_info gdb_protocol] == "extended-remote" } { verbose -log "APB: warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\." -gdb_test "attach $testpid" \ - [multi_line \ - "Attaching to process $decimal" \ - "warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\." \ - ".*"] \ - "attach to inferior" +gdb_test_multiple "attach $testpid" "attach to inferior" { + -re "Attaching to process $decimal\r\n" { + exp_continue + } + -re "\\\[New Thread \[^\r\n\]+\\\]\r\n" { + # Non-stop targets may emit async thread notifications. + exp_continue + } + -re -wrap "warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\..*" { + pass $gdb_test_name + } +} # Check GDB hasn't managed to load an executable. gdb_test "info inferior" \ -- 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