From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ofbtG5fWKmpetQEAWB0awg (envelope-from ) for ; Thu, 11 Jun 2026 11:39:03 -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=Ih2COQLh; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6C9CE1E098; Thu, 11 Jun 2026 11:39:03 -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 BE5551E070 for ; Thu, 11 Jun 2026 11:39:02 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF85F4BA23C3 for ; Thu, 11 Jun 2026 15:39:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF85F4BA23C3 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=Ih2COQLh Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by sourceware.org (Postfix) with ESMTPS id 687C94BAD17B for ; Thu, 11 Jun 2026 15:35:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 687C94BAD17B 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 687C94BAD17B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781192129; cv=none; b=UZPLXKLf+0EZBUQl883nTMnDYX9Wdrfv1h6xP6deRggqhRv4JmTfPSYWCq4gb/hYMO63S2IweXO8pnpyOwEDdu0pCpIktJQLfBm6niJHebmITQ5nbgTcMJwLvFM0HXFA1EkJA93EQ+D+bak4XZYnYkuZTzSxKKpPMpfkd2PfXxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781192129; c=relaxed/simple; bh=ygmZIWiinLWY4xbwic2rcKzFUEU8liX1qf4S/Thoi0M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=D2/cJi6FaL+54hK6l9gFJFOMRRnJNp2E1j9h7XAlMYKenMeALu8jF64yPrh21Kwp9+ATnJRR2+nrT4a+aV1n2zkpCLuOhdSsgkISJlVYL+NkBXZqD91R3sRIvq9ilOcu+tZbnRkoJhE6/sFHQrYdFOrzkvVHqq73rJvZbTZyUFs= 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=Ih2COQLh DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 687C94BAD17B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781192130; x=1812728130; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ygmZIWiinLWY4xbwic2rcKzFUEU8liX1qf4S/Thoi0M=; b=Ih2COQLhBpy8/fr3xmH/a9ws0ZTKKqrbOUXfkD+gUYkVOXctO0vybpV4 BQ1vvrAOjXUwTWvwObObDU/gg0Gtrx/JshQBNFQLMXD8mdnROxZ0+c4+2 Xf3sAYjRuE6XaPErbhEhAVfukqVk4l7hLgngUL6KHOHTm/sVRkW/0ewIh kcq1NppG9VpdSDyaKT9EbpXZobXOQyI+vxooJ0L/1l9NfzkU+lljPUa4/ Ju0/o7LmfSUili/ylwcbKaLc5yputXtBi+YxwkFgUxCn6WRx0Gtn5GH1a kG8Bs22R9GsijOTuH4M/VADXZuXup7XWJYNy/GeI230IsrhKKa1M/OXlo g==; X-CSE-ConnectionGUID: a/F45EgtSoWlDsbXd0s25Q== X-CSE-MsgGUID: wn30xnZ3Qo6HyxAV7hh2tw== X-IronPort-AV: E=McAfee;i="6800,10657,11813"; a="82013276" X-IronPort-AV: E=Sophos;i="6.24,199,1774335600"; d="scan'208";a="82013276" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2026 08:35:28 -0700 X-CSE-ConnectionGUID: 86f05oC1QBSt0xgE/GTkbA== X-CSE-MsgGUID: 9D/5sdLPR7q/Z7YHawX/Bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,199,1774335600"; d="scan'208";a="243577361" Received: from womilian-mobl.ger.corp.intel.com (HELO localhost) ([10.245.82.28]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2026 08:35:26 -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 09/11] gdb, testsuite: update attach-deleted-exec.exp to handle async messages Date: Thu, 11 Jun 2026 17:32:29 +0200 Message-ID: <20260611153232.3011-10-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: "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 5d3f43eff00..69233ddaffd 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. @@ -97,12 +100,18 @@ if { [target_info gdb_protocol] == "extended-remote" } { set filename_re "\[^\r\n\]+/${testfile} \\(deleted\\)" } -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