From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +agUDgwAVmpWiQcAWB0awg (envelope-from ) for ; Tue, 14 Jul 2026 05:23:24 -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=CVFU9hgy; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2F1CB1E09E; Tue, 14 Jul 2026 05:23:24 -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 E98FC1E099 for ; Tue, 14 Jul 2026 05:23:22 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C6AF74BA2E2D for ; Tue, 14 Jul 2026 09:23:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6AF74BA2E2D 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=CVFU9hgy Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by sourceware.org (Postfix) with ESMTPS id B43684BA23C6 for ; Tue, 14 Jul 2026 09:22:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B43684BA23C6 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 B43684BA23C6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784020952; cv=none; b=fqMnHYBoG8pIb06exXaG89BOMb/rpOSBmrFZom0ayquZEzSftzJmmIxnXxn1LLlTwdA4yjHo8sE9nX/mLhjwrqOgxZDIParRY1PkEhkooFp53nxgfIXVikDUeviKfPz+TWCgjhlnYwzVsbwmAiJ8Ksl0e5osw9RJvbjC8vcr+nI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784020952; c=relaxed/simple; bh=UB+d5XtqOSip3wi42/zBOq6jBncG33rxrznz+2Gqzq8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=a4Omj5lMtCFx4zOUnd8Ot2LsCNMaKuolnlyXKmw/vNDnQWEOEUOfOai7YuIMUmAO33kFRDe9kD0SlzrbmSu7Cm8dFzuLN/+15Xe5+1BDBbGdi8bWrUuL2QHlXQwhd18XcFtmvFjVRfbFvoxYZPXtJBwrCQbp0h62eqFhWCehF68= 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=CVFU9hgy DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B43684BA23C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784020952; x=1815556952; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UB+d5XtqOSip3wi42/zBOq6jBncG33rxrznz+2Gqzq8=; b=CVFU9hgy0u2yB5js9s7GNqjy3Paw/SbbsAbh7F8SgqUpFstEWBATVCBv tpOoyYy7DaMXdId/ytNUxDuojpKvShE7F70f1Mqrn19o04K0pRUc7Yt0Q eJU9DvSDuFyG6rL3P9NleNe9AHB2CZyrGFEHaU7Qso/zVydtrw5HBaCFt HP6VBUqN7eF96i/tB9PH2awFoESZ+SkYeCBronNGB/HlJ43Dg5UWl/rza JqU1S58qAEI/4y6ybyE0t+KgTM67Kv/HQCDJAZhG1bTl3jQqRNxcDAiJ2 TGIR7VHCBLaSRdWsCECgVe7iNohfT0dNQHd0bg8rzDiZQHfElNODfsbTC g==; X-CSE-ConnectionGUID: hy+hNxkeRW+lRtvZgqeS9w== X-CSE-MsgGUID: KJH+wY6jQ/Ky8vO8F7+yhg== X-IronPort-AV: E=McAfee;i="6800,10657,11846"; a="88537982" X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="88537982" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 02:22:31 -0700 X-CSE-ConnectionGUID: n7d0LLQIRyGZrFKyH0Ctqw== X-CSE-MsgGUID: XYPkubJgTpObfxs6G8Vfug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="293998185" Received: from sguenant-mobl2.ger.corp.intel.com (HELO localhost) ([10.246.18.94]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 02:22:30 -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 09/11] gdb, testsuite: update attach-deleted-exec.exp to handle async messages Date: Tue, 14 Jul 2026 11:21:26 +0200 Message-ID: <20260714092128.12941-10-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: "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 ... Reproducible when running gdb.base/attach-deleted-exec.exp, on native-extended-gdbserver with target-non-stop enabled. export GDBFLAGS="-iex \"maint set target-non-stop on\"" make check TESTS="gdb.base/attach-deleted-exec.exp" \ RUNTESTFLAGS="--target_board=native-extended-gdbserver GDBFLAGS='$GDBFLAGS'" --- .../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