From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by sourceware.org (Postfix) with ESMTPS id 98CF33888C57 for ; Wed, 30 Mar 2022 19:29:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 98CF33888C57 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id h16so12923537wmd.0 for ; Wed, 30 Mar 2022 12:29:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xwEueswqPJzGi8GBPxf3NFK9EBlJL5EzTwMt7WYkxgo=; b=RFHHOQvw9iQktC1u3HWVu1c+tJBHKnIW6mAE1NezKHUTp3wDNr73dpwfngo1SKQE9Z mGmjasSh7fuChJiWY4KnCreUXEerhrxsumGaCBeLINapfwxBWRV3Fhmt4U+wIiM2h9/0 4QXVemQlNoAdp9M1WmZl/zlv6589Tgzf82jGaB9C8pkg1rzIC6jMLkmKplg3obVnMo/7 F0TzicObwu0SpB6DlIBaHYMIUXQaLYnnayehUb88oYX22LOhJcSquFGSLPY7+Fmqm7zp usw20AUp+ako82TdrthCQ3fAFqKBHl3TI2atyxcTpcYQoK+SAuqXJnCZxU5CkFwXwJ1O HoyQ== X-Gm-Message-State: AOAM531Pj+JYAsVnWaTnSY15iSR5YuOSLNkvDk9b2vhvUbMcCmxtKV3a 4AqcLj/Otypl9bwQ7s7vKtUJJ8DbCbA= X-Google-Smtp-Source: ABdhPJz4KEa45tV0uSHTPEe88neHTTx/TJ5a3r8uQVd8TEaT619bgZkM8sBANGQC4LtTdzSeYRh2KQ== X-Received: by 2002:a1c:3bc3:0:b0:38c:9a42:a143 with SMTP id i186-20020a1c3bc3000000b0038c9a42a143mr1165553wma.64.1648668579830; Wed, 30 Mar 2022 12:29:39 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id i2-20020a05600c354200b0038cb422e3fesm5699963wmq.32.2022.03.30.12.29.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Mar 2022 12:29:39 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 4/5] Avoid having to unload file in gdb.server/connect-with-no-symbol-file.exp Date: Wed, 30 Mar 2022 20:29:28 +0100 Message-Id: <20220330192929.3161015-5-pedro@palves.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220330192929.3161015-1-pedro@palves.net> References: <20220330192929.3161015-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2022 19:29:43 -0000 gdb.server/connect-with-no-symbol-file.exp's connect_no_symbol_file does: gdb_test "file" ".*" "discard symbol table" \ {Discard symbol table from `.*'\? \(y or n\) } "y" A following patch will make gdb_test expect the question out of GDB if one is passed down as argument to gdb_test. With that, this test starts failing. This is because connect_no_symbol_file is called in a loop, and the first time around, there's a loaded file, so "file" asks the "Discard symbol table ... ?" question, while in the following iterations there's no file, so there's no question. Fix this by not loading a file into GDB in the first place. Change-Id: I810c036b57842c4c5b47faf340466b0d446d1abc --- .../gdb.server/connect-with-no-symbol-file.exp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp index af5917d9018..6c480c8c0cf 100644 --- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp +++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp @@ -29,7 +29,7 @@ if { [skip_gdbserver_tests] } { return 0 } -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { +if { [build_executable "failed to prepare" $testfile $srcfile debug] } { return -1 } @@ -46,22 +46,16 @@ proc connect_no_symbol_file { sysroot action } { with_test_prefix "setup" { # Copy the symbol file to the target. - gdb_remote_download target $binfile.bak $binfile + set target_exec [gdb_remote_download target $binfile.bak $binfile] # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. gdb_test "disconnect" ".*" - # Discard any symbol files that we have opened. - gdb_test "file" ".*" "discard symbol table" \ - {Discard symbol table from `.*'\? \(y or n\) } "y" - # Set sysroot to something non-target and possibly also invalid so that # GDB is unable to open the symbol file. gdb_test_no_output "set sysroot $sysroot" "adjust sysroot" - set target_exec [gdbserver_download_current_prog] - # Start GDBserver. set res [gdbserver_start "" $target_exec] @@ -70,9 +64,9 @@ proc connect_no_symbol_file { sysroot action } { # Perform test actions to the symbol file on the target. if { $action == "delete" } then { - remote_file target delete $binfile + remote_file target delete $target_exec } elseif { $action == "permission" } { - remote_spawn target "chmod 000 $binfile" + remote_spawn target "chmod 000 $target_exec" } # Connect to GDBserver. @@ -89,6 +83,9 @@ proc connect_no_symbol_file { sysroot action } { # Make sure we have the original symbol file in a safe place to copy from. gdb_remote_download host $binfile $binfile.bak +# Start with no executable loaded. +clean_restart + # Run the test with different permutations. foreach_with_prefix sysroot {"" "target:"} { foreach_with_prefix action {"permission" "delete"} { -- 2.26.2