From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yXfpNR6cS2pKvCkAWB0awg (envelope-from ) for ; Mon, 06 Jul 2026 08:14:22 -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=WULVZMxc; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D99B31E070; Mon, 06 Jul 2026 08:14:22 -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 4ECB31E070 for ; Mon, 06 Jul 2026 08:14:22 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 778BA4BA2E0B for ; Mon, 6 Jul 2026 12:14:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 778BA4BA2E0B 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=WULVZMxc Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by sourceware.org (Postfix) with ESMTPS id 3B8414BA2E1F for ; Mon, 6 Jul 2026 12:13:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B8414BA2E1F 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 3B8414BA2E1F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783340026; cv=none; b=hld/uRYdhFltHcTjlpwqMTbUSI2rkY1oy/B/begXyAgv0EuNdMPKOUeM4O8Vwj3h2EEISQLeoHbLiNHQT6C+4RnVSotgm4BbY3zGwo4bQKqpcLzmzXPrSmnuhy5IRyChtinYyiM0l6UjDsdE1M8/LnnXTSxq+jvRHYTu8RL23pM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783340026; c=relaxed/simple; bh=UB+d5XtqOSip3wi42/zBOq6jBncG33rxrznz+2Gqzq8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nUVZ+LNuELUKwuLhuCCC2gAupxOvyD3MnSjE0fqIxnUy8DImIBRq8Cdsxpm/FRtwiL8zuWSEyFcA56GeDf1vljLDqL5Z8z8ucqAdyFF3ofqtlp4g8h1b3FzVT260aJKJozfeoK6O6BRERl7KA0z7H+8p9ibEw+wYbyW+FVGlloU= 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=WULVZMxc DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B8414BA2E1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783340026; x=1814876026; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UB+d5XtqOSip3wi42/zBOq6jBncG33rxrznz+2Gqzq8=; b=WULVZMxc9s6/zMeKkQCNC3ueN6jEUMhksKMBFIioRH7r/1SST1XT16ml kEka6TuyUz9iOgl7avA3Hx5OaItxifsXrGFLQ7/6LspymDrsweJKITi9E jQwu8QpG3BsJdNBHOTBehhTwL9TT5OpmNjen6HJ/1jJytK0PNIxdtNMYZ ktUTYfr8h8GnA1PvTMPufqxpqQ7ucseI4OPSjwwvx+ca33KKxAOBFoh1K RtkZLR9Z/LpcI+BggGdziECkmzNeGdnlMpSR1rc3/QvqgUwPpVIVAcba0 hHRMKDH6OLv+J6TJOYYV7ysDQfo4ZvgzTBysoJ4XUSP7wiadfukUPrdyn w==; X-CSE-ConnectionGUID: vb6Snm9rRyupdyoTChtMjQ== X-CSE-MsgGUID: 4o/nZwT2QVOKyeUm/AWu1Q== X-IronPort-AV: E=McAfee;i="6800,10657,11838"; a="101516771" X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="101516771" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:13:45 -0700 X-CSE-ConnectionGUID: PK+csVX7TKiqgweeoncGbg== X-CSE-MsgGUID: LSRAbh/eQIifKtWsik8afw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="251015973" Received: from unknown (HELO localhost) ([10.245.114.180]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:13:44 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: stephan.rohr@intel.com, markus.t.metzger@intel.com, pedro@palves.net, aburgess@redhat.com Subject: [PATCH v3 09/11] gdb, testsuite: update attach-deleted-exec.exp to handle async messages Date: Mon, 6 Jul 2026 14:11:22 +0200 Message-ID: <20260706121124.18784-10-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706121124.18784-1-mohamed.bouhaouel@intel.com> References: <20260706121124.18784-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