From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /VfBLTD2Z2m1lAMAWB0awg (envelope-from ) for ; Wed, 14 Jan 2026 15:01:52 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AuFsflZ8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id AD83A1E0DD; Wed, 14 Jan 2026 15:01:52 -0500 (EST) 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 E05581E08D for ; Wed, 14 Jan 2026 15:01:51 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 58D044BA2E38 for ; Wed, 14 Jan 2026 20:01:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58D044BA2E38 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AuFsflZ8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 456DD4BA2E07 for ; Wed, 14 Jan 2026 20:01:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 456DD4BA2E07 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 456DD4BA2E07 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768420883; cv=none; b=QRljyDLB5NHWpyNGM+sPTO/fE0bkN3VWCtHYB95bPKYBvk5+NM8bBLTmaFsNtemZiqDVDtfMtJtGKnsbEgmZkZwa59v8F+803ljY/ygxPInuhCZp9vHkS/3qvU7FEbOtZxfU2RJbfxCFBCUnfe7Bd+fju7pJ2+UytIkqkY56nLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768420883; c=relaxed/simple; bh=u7CdPT7c7GaREnAa9YI1FvX2FNz8z+Hzs2tupiITIRU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=p7ibiF+KkgnkM4SUIn1nDPOuh0lnToV5syzS8KFwVFXwLZ608vtCxL+lgVEa6QerXJ+2aysqtvTDtSOPlSD5Nw4gRz9KXSZSKgBwNW6/9PiDnxs7mRgQAZt4+dcvK3+2FOkloVhaZ9/jfyRn5JaNvlZXYS8pMRw2owo7BKrgWe0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 456DD4BA2E07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768420882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WxuBRGL4qSgSrAIJ6SEYQOh8HEy6bA4ePQj+aOTzRSg=; b=AuFsflZ8szGa2h0CLm/i2ph584qm+mUIr8pYRbxPy0bM+VUQnJJXomktk1r6nJos8bCgrj IwowTkKDsAuP2/oJmsEWYipW6lYWz0JZ5wvckc80zhcxK8iWLQWwGhCHdkA0e6dg4DNdID P5Fj3X5315nzhtiYTBIm1BkdVl229/0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-kTGHRwclMUqtkqEweswRCw-1; Wed, 14 Jan 2026 15:01:21 -0500 X-MC-Unique: kTGHRwclMUqtkqEweswRCw-1 X-Mimecast-MFC-AGG-ID: kTGHRwclMUqtkqEweswRCw_1768420880 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-47edf8ba319so1621705e9.2 for ; Wed, 14 Jan 2026 12:01:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768420880; x=1769025680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WxuBRGL4qSgSrAIJ6SEYQOh8HEy6bA4ePQj+aOTzRSg=; b=mBYuhQI0ijBZEQBytiapNZ2+jlLy2+f4q+EpLKwiBSQb05dakRjc7bxhg/+hUOLB5b 4yObowwBytNae8rtmX9V1VvO+Ca836j9KezJadsGl8bX4aVruYl4sIbgtFowdSDHjGJl 1sf6A4rSqJzHpkGXg+76edw7oMZ9fYilxAF5+RY1bZY584WpA0+NXRymJSM1IKA+1dGZ WDrEv9cG5kpQRFAZQvRM3qGwqYIUXLhk+w+3L3q0mGv6nJ7EkyeiMoe/YpkaPT1h3eaz kQkGIMy4kIbNCNWTsji12ll1Dsf26xogrFxklZGYfV9MQ60W2P8En3rSpUifxVI7jyoU 5Keg== X-Gm-Message-State: AOJu0YwTVSOEravHk9rJ6B/48jZ4m2bgtkBzkAm35aezidKtgIZ1cNGb +NrzXot7eow4vcorrMnTOkvTlpwr1dzX1M0tEQbw69tDt+SVvj9/xeD3za8hOqAnMdbW9/qZa9G MCW4D9DkXpgxlhxnvlT3gk0h9tfSyhIVqUHAIJdhS60lnEM+dfexELdXqma+RwzS+DPhN9fdd8V zisjrsmrl7o+Ft6MWJ49y/DsB4BhcP5TJXxp7wil+SWE+99jI= X-Gm-Gg: AY/fxX6cp3h14eriZuJLNi24Y5HVIAipv2dhgehpnrZgPtkhBXiN51srhOdlnU1TvXV zItOVcKcseLCy7IfdGV/ZOwiry7g8Bnoj5a5fw+fI7YRWvrXRAs2uAcHg3nWXj86fB3FB0JNb/9 qgAaV1J+76ExhgS8Lc7uAeJMtQ3+YArBAc6wfuOqwNyWyrdo1Hhm+0VNDDzHHsRLufE7NrwXEs8 v2BQKXzgNMXYGm/UwWrK0XUEMRV7QBns5/BScd6Ilhtj3/4KDiGRSzGI6GMJjy6lc7UY/JC3D7D Ot2SnhOeTqtNkSgYPLegaKKPUyY0xslZm2HHqcvL9RxOuAlC22Qpw8okf+Ia1mivaRqT98Mg6U0 I9hXhafOxUrHlcMYOZfXqwfGG8/z3CbNO9A== X-Received: by 2002:a05:600c:8b76:b0:477:5c58:3d42 with SMTP id 5b1f17b1804b1-47ee32ffaa7mr40836635e9.10.1768420879797; Wed, 14 Jan 2026 12:01:19 -0800 (PST) X-Received: by 2002:a05:600c:8b76:b0:477:5c58:3d42 with SMTP id 5b1f17b1804b1-47ee32ffaa7mr40836435e9.10.1768420879321; Wed, 14 Jan 2026 12:01:19 -0800 (PST) Received: from localhost (92.40.185.100.threembb.co.uk. [92.40.185.100]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47f42907141sm7393425e9.9.2026.01.14.12.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 12:01:19 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/testsuite: fix failure in gdb.server/fetch-exec-and-args.exp Date: Wed, 14 Jan 2026 20:01:15 +0000 Message-ID: <19b4a897d945398861334de10c7c2c3367ecec3a.1768420854.git.aburgess@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <3d52893e-d2a8-48e9-aab0-b0c85d736de4@simark.ca> References: <3d52893e-d2a8-48e9-aab0-b0c85d736de4@simark.ca> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: wEUd5RZP6Mq6VvKLjf9Hmsxp6IwPOaAz1c-8E-H9Qm0_1768420880 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 Bug PR gdb/33792 reported a gdb.server/fetch-exec-and-args.exp FAIL when using the native-gdbserver board: FAIL: gdb.server/fetch-exec-and-args.exp: packet=on: set_remote_exec=false: test_server_with_no_exec: show remote exec-file The actual test output looks like this: (gdb) show remote exec-file The remote exec-file is unset, using automatic value "/tmp/build/gdb/testsuite/outputs/gdb.server/fetch-exec-and-args/fetch-exec-and-args". (gdb) FAIL: gdb.server/fetch-exec-and-args.exp: packet=on: set_remote_exec=false: test_server_with_no_exec: show remote exec-file This test actually fails with native-gdbsever and native-extended-gdbserver boards. The problem is that these boards clear the sysroot. This exact test has the following conditions: + The qExecAndArgs is in use (see 'packet=on'). + We're not explicitly doing 'set remote exec-file ...' (see 'set_remote_exec=false'). + The test starts gdbserver without an executable (see 'test_server_with_no_exec'). + And because of the native-gdbsever board, the sysroot is "". What this means is that GDB knows that gdbserver doesn't have an executable thanks to qExecAndArgs, the user hasn't set an executable for GDB to use when starting a new inferior, but GDB does know that GDB and gdbserver can see the same filesystem due to the sysroot setting. GDB will then automatically use the current executable as the remote executable name. The test script doesn't expect this case, and so the test fails. Fix this by adjusting the script to expect the 'using automatic value ...' text when appropriate. I also extended the test_server_with_no_exec proc to take a new flag 'clear_sysroot', we now run the test with the sysroot set to 'target:' and with the sysroot set to "", even when using the 'unix' board. Additionally, I ran the test through check-all-boards and found one additional failure, when using --host_board=local-remote-host-native and --target_board=local-remote-host-native. In this case GDB copies the executable to the remote host, which changes its filename. When the filename appears in the 'using automatic value ...' text, I was expecting the filename assuming a local host. I could fix this, but it doesn't seem worth the extra complexity for this one test, so I've just set the test to be skipped for that one configuration. Now, when using check-all-boards, I'm seeing no failures. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33792 --- .../gdb.server/fetch-exec-and-args.exp | 57 +++++++++++++++++-- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.server/fetch-exec-and-args.exp b/gdb/testsuite/gdb.server/fetch-exec-and-args.exp index d85cd94fb1d..36189dec602 100644 --- a/gdb/testsuite/gdb.server/fetch-exec-and-args.exp +++ b/gdb/testsuite/gdb.server/fetch-exec-and-args.exp @@ -54,11 +54,22 @@ proc check_show_args { packet } { # 'off' and reflects whether the qExecAndArgs packet is turned on or # off. FILENAME is what we expect to see included in the output, and # is converted to a regexp by this function. -proc check_remote_exec_file { packet filename } { +# +# The AUTO_FILENAME should only be set when PACKET is on and FILENAME +# is the empty sting. If AUTO_FILENAME is set, then this is the +# filename that GDB is using for the remote executable based on the +# current executable's filename. For example, if the sysroot is empty +# then GDB can use the current executable as the remote executable. +proc check_remote_exec_file { packet filename { auto_filename "" } } { if { $filename eq "" } { if { $packet } { - set remote_exec_re \ - "The remote exec-file is unset, the remote has no default executable set\\." + if { $auto_filename ne "" } { + set remote_exec_re \ + "The remote exec-file is unset, using automatic value \"[string_to_regexp $auto_filename]\"\\." + } else { + set remote_exec_re \ + "The remote exec-file is unset, the remote has no default executable set\\." + } } else { set remote_exec_re \ "The remote exec-file is unset, the default remote executable will be used\\." @@ -260,9 +271,35 @@ proc_with_prefix test_remote_exec_warning {} { # filename when starting gdbserver. # # Connect to the remote server, and check 'show remote exec-file'. -proc_with_prefix test_server_with_no_exec { packet set_remote_exec } { +proc_with_prefix test_server_with_no_exec { packet set_remote_exec clear_sysroot } { + # For remote hosts GDB copies the executable to the host, changing + # its filename. We can figure out the new exec filename, but it's + # additional work, so just don't bother. We only need to bail out + # though in the precise case that the executable filename will be + # used in the output. + if {!$set_remote_exec && $clear_sysroot && [is_remote host]} { + return + } + clean_restart + set sysroot "*UNKNOWN*" + gdb_test_multiple "show sysroot" "" { + -re -wrap "^The current system root is \"(\[^\r\n\]*)\"\\." { + set sysroot $expect_out(1,string) + pass $gdb_test_name + } + } + if { $sysroot ne "target:" && $sysroot ne "" } { + return + } + + if { $clear_sysroot } { + gdb_test_no_output "set sysroot" + } else { + gdb_test_no_output "set sysroot target:" + } + gdb_test "disconnect" ".*" gdb_file_cmd $::binfile @@ -277,13 +314,18 @@ proc_with_prefix test_server_with_no_exec { packet set_remote_exec } { gdb_test_no_output "set remote exec-file $target_exec" \ "set remote exec-file" set expected_filename $target_exec + set auto_filename "" + } elseif { $clear_sysroot } { + set expected_filename "" + set auto_filename $::binfile } else { set expected_filename "" + set auto_filename "" } gdbserver_start_extended - check_remote_exec_file $packet $expected_filename + check_remote_exec_file $packet $expected_filename $auto_filename } # This override prevents the remote exec-file from being set when @@ -298,7 +340,10 @@ with_override extended_gdbserver_load_last_file do_nothing { test_exec_and_arg_fetch $packet foreach_with_prefix set_remote_exec { true false } { - test_server_with_no_exec $packet $set_remote_exec + foreach_with_prefix clear_sysroot { true false } { + test_server_with_no_exec $packet $set_remote_exec \ + $clear_sysroot + } } } base-commit: 141f3b0ce1a4141ec0bbd19f1c5713999113a7de -- 2.47.1