From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gzCvJ7DLJmXPIisAWB0awg (envelope-from ) for ; Wed, 11 Oct 2023 12:22:08 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=fCdA28El; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 94D281E0C1; Wed, 11 Oct 2023 12:22:08 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 67EF21E091 for ; Wed, 11 Oct 2023 12:22:06 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3382B3858039 for ; Wed, 11 Oct 2023 16:22:05 +0000 (GMT) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by sourceware.org (Postfix) with ESMTPS id 603E23858D1E for ; Wed, 11 Oct 2023 16:21:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 603E23858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-7a5a746e355so31107939f.0 for ; Wed, 11 Oct 2023 09:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1697041309; x=1697646109; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FF2F5pA5aPcisqVpMCnDssvNxDWmbG7Li54z8xr47nA=; b=fCdA28ElK6ln9bs97u6Wu5Af8toXTG2Tvsm8ZVTcFmqKceYKT/FDGTVGqiJh+5KV5E coMXNtxxz+bi0y7kevYjvR9RWarQOZ94InzW3D3gllI+/zxzNkTJgtT9i347YJYblWRu hCXpMr8pN3R8nyzKM+P3BJKQDcxCyq8/rcP4KQBFDdYh4lV4G75N3PbaA0si6YzAR493 u7ii2W8HBnUb1TebM6eHdeDHoZ7AazIFvsAo4wlij/sM+2fgZTxRchFZtTP07ZI00Cy6 6ta8DhiUTNrcqSyiwThXIT0ePG1ESefhdjeGP9DwNXT3NV/hT+2d6RB21yAuvAxoeqFj E9NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697041309; x=1697646109; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FF2F5pA5aPcisqVpMCnDssvNxDWmbG7Li54z8xr47nA=; b=rCqw14+dpoj/N6eeKvHQmYZrAXvr7VrWRYIgQ2mZ6SvmorO9tCVwlhtjMza7FW40v/ 0GXKnvEjW3Kbj5vCFz4WLA7bmv6lX7+JCFUiL75QokfGngBkS2XSz9z34fCfvXPh8sXR TKm457qSs41015YVoDZUftxDWBumJM+pFHOirdD1vAup8rINkPADPRW/+oPOoFEHhHYA JbfOJe0u3It6Lvz7sePNB96MTc3jw1D9tHbgPPQminjMYqRiMAI7Y9PGhn21hYOvPtYU IdgVjknKbtdpsUnhn3zXROjcBEF8yLpJpxomenDoH2fWKXaFuX+iHBU8cnVhDxu2vhAb jDuQ== X-Gm-Message-State: AOJu0YzXUxSgl0+xFgW+JHzxgynbRyAdLW0KA4HfEEq6d83kWetrELXq AHgnLyN7JfYjrqy3ecCdOU5eqZh74ofirPpfrwRWwg== X-Google-Smtp-Source: AGHT+IEjXqbYM1mUntQoH/e05nWqwmkZHO7sXH5U1votw9cxCvcv6vNownFQAdNTxlP+tm8uJl3o3g== X-Received: by 2002:a05:6602:717:b0:790:83e7:5000 with SMTP id f23-20020a056602071700b0079083e75000mr12620224iox.2.1697041309311; Wed, 11 Oct 2023 09:21:49 -0700 (PDT) Received: from localhost.localdomain (71-211-130-31.hlrn.qwest.net. [71.211.130.31]) by smtp.gmail.com with ESMTPSA id g8-20020a02cd08000000b00445630238cfsm3508110jaq.48.2023.10.11.09.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 09:21:48 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix test suite failure in file-then-restart.exp Date: Wed, 11 Oct 2023 10:21:42 -0600 Message-Id: <20231011162142.2725265-1-tromey@adacore.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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 Simon pointed out that the new file-then-restart.exp test fails with the extended-remote target board. The problem is that the test suite doesn't use gdb_file_cmd -- which handles things like "set remote exec-file". This patch changes gdb_file_cmd to make the "kill" command optional, and then switches the test case to use it. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30933 --- .../boards/native-extended-gdbserver.exp | 4 +-- gdb/testsuite/gdb.ada/file-then-restart.exp | 8 ++---- gdb/testsuite/lib/gdb.exp | 25 +++++++++++-------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp index 844d032ed73..64ff3060ca2 100644 --- a/gdb/testsuite/boards/native-extended-gdbserver.exp +++ b/gdb/testsuite/boards/native-extended-gdbserver.exp @@ -95,8 +95,8 @@ proc extended_gdbserver_load_last_file {} { if { [info procs extended_gdbserver_gdb_file_cmd] == "" } { rename gdb_file_cmd extended_gdbserver_gdb_file_cmd } -proc gdb_file_cmd { arg } { - if [extended_gdbserver_gdb_file_cmd $arg] { +proc gdb_file_cmd { arg {kill_flag 1} } { + if [extended_gdbserver_gdb_file_cmd $arg $kill_flag] { return -1 } return [extended_gdbserver_load_last_file] diff --git a/gdb/testsuite/gdb.ada/file-then-restart.exp b/gdb/testsuite/gdb.ada/file-then-restart.exp index e2c76b666e3..6940d7f5ba2 100644 --- a/gdb/testsuite/gdb.ada/file-then-restart.exp +++ b/gdb/testsuite/gdb.ada/file-then-restart.exp @@ -50,12 +50,8 @@ foreach_with_prefix scenario {kill no-kill} { gdb_test_no_output "set confirm off" - if {$scenario == "kill"} { - gdb_test "kill" "Inferior $decimal .*killed.*" - } - - gdb_test "file $binfile2" "Reading symbols from .*" \ - "switch to second executable" + set result [gdb_file_cmd $binfile2 [expr {$scenario == "kill"}]] + gdb_assert {$result == 0} "switch to second executable" # Start the program a second time, GDB should land in procedure # Second this time. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0a908e0af0f..63885860795 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2146,6 +2146,9 @@ proc default_gdb_exit {} { # Load a file into the debugger. # The return value is 0 for success, -1 for failure. # +# ARG is the file name. +# KILL_FLAG, if given, indicates whether a "kill" command should be used. +# # This procedure also set the global variable GDB_FILE_CMD_DEBUG_INFO # to one of these values: # @@ -2165,7 +2168,7 @@ proc default_gdb_exit {} { # TODO: gdb.base/sepdebug.exp and gdb.stabs/weird.exp might be able to use # this if they can get more information set. -proc gdb_file_cmd { arg } { +proc gdb_file_cmd { arg {kill_flag 1} } { global gdb_prompt global GDB global last_loaded_file @@ -2194,15 +2197,17 @@ proc gdb_file_cmd { arg } { # The file command used to kill the remote target. For the benefit # of the testsuite, preserve this behavior. Mark as optional so it doesn't # get written to the stdin log. - send_gdb "kill\n" optional - gdb_expect 120 { - -re "Kill the program being debugged. .y or n. $" { - send_gdb "y\n" answer - verbose "\t\tKilling previous program being debugged" - exp_continue - } - -re "$gdb_prompt $" { - # OK. + if {$kill_flag} { + send_gdb "kill\n" optional + gdb_expect 120 { + -re "Kill the program being debugged. .y or n. $" { + send_gdb "y\n" answer + verbose "\t\tKilling previous program being debugged" + exp_continue + } + -re "$gdb_prompt $" { + # OK. + } } } -- 2.40.1