From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 4EA55388F057 for ; Mon, 11 May 2020 14:54:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4EA55388F057 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.193] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 8C9BC1E79B; Mon, 11 May 2020 10:54:58 -0400 (EDT) Subject: [PATCH] gdb/testsuite: fix gdb.base/with.exp failure with, native-extended-gdbserver (was: New FAIL on gdb.base/with.exp on native-extended-gdbserver) To: Sergio Durigan Junior , Pedro Alves Cc: gdb-patches@sourceware.org, Philippe Waroquiers References: <20190618003902.19805-1-palves@redhat.com> <8e2afe6f-a568-3b05-503c-368d574adb5f@redhat.com> <87wofvtal6.fsf_-_@redhat.com> From: Simon Marchi Message-ID: <0761e02d-dd1c-22fe-3d10-4ae5849cdd73@simark.ca> Date: Mon, 11 May 2020 10:54:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <87wofvtal6.fsf_-_@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Mon, 11 May 2020 14:55:09 -0000 On 2019-08-02 7:24 p.m., Sergio Durigan Junior wrote: > On Wednesday, July 03 2019, Pedro Alves wrote: > >> On 6/18/19 1:38 AM, Pedro Alves wrote: >>> >>> (gdb) help with >>> Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING. >>> Usage: with SETTING [VALUE] [-- COMMAND] >>> Usage: w SETTING [VALUE] [-- COMMAND] >>> With no COMMAND, repeats the last executed command. >>> SETTING is any setting settable with the "set" command. >>> E.g.: >>> with language pascal -- print obj >>> with print elements unlimited -- print obj >>> >> >> I've merged this in now. > > Hi Pedro, > > First of all, thanks for the nice feature. > > BuildBot has unfortunately caught a new failure on gdb.base/with.exp > when run agains native-extended-gdbserver: > > https://sourceware.org/ml/gdb-testers/2019-q3/msg00213.html > > new FAIL: gdb.base/with.exp: repeat: reinvoke with no previous command to relaunch > > I've also found it here when preparing a new Fedora GDB release. > > Thanks, Here's a patch for this >From 4927107e4d99cc81e36c699d5716ea8d76fb7101 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 11 May 2020 10:17:38 -0400 Subject: [PATCH] gdb/testsuite: fix gdb.base/with.exp failure with native-extended-gdbserver I see this failure when running: $ make check TESTS="gdb.base/with.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver" FAIL: gdb.base/with.exp: repeat: reinvoke with no previous command to relaunch This test issues `with language ada` and expects GDB to complain that there is no command to repeat (either because the history is empty or the previous command is non-repeatable). However, with the native-extended-gdbserver board, the `set remote exec-file` command is issued during `clean_restart`, and it is a repeatable command, so GDB doesn't print the expected message: (gdb) set remote exec-file /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/with/with^M (gdb) with language ada^M (gdb) FAIL: gdb.base/with.exp: repeat: reinvoke with no previous command to relaunch Fix it by using gdb_spawn instead of clean_restart. gdb_spawn fires up GDB and does not issue any command, not even `set height` and `set width`. I've also added a separate test for trying to repeat a non-repeatable command, since that's a slightly different case than trying to repeat without history. gdb/testsuite/ChangeLog: * gdb.base/with.exp: Start GDB with gdb_spawn for repeat test. Add test for trying to repeat a non-repeatable command. --- gdb/testsuite/gdb.base/with.exp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/with.exp b/gdb/testsuite/gdb.base/with.exp index a60ccf307468..e86e49618a7f 100644 --- a/gdb/testsuite/gdb.base/with.exp +++ b/gdb/testsuite/gdb.base/with.exp @@ -175,15 +175,22 @@ with_test_prefix "user-defined" { # Check repeating. with_test_prefix "repeat" { - clean_restart $binfile + # Start GDB like this (as opposed to gdb_start/clean_restart) for the first + # test to make sure no command is issued after starting the GDB process. + gdb_exit + gdb_spawn + gdb_test "" "" "wait for initial prompt" - # "with" with no command reinvokes the previous command. + # "with" with no command in the history. gdb_test "with language ada" \ "No previous command to relaunch" \ "reinvoke with no previous command to relaunch" - gdb_test "print g_s" " = {a = 1, b = 2, c = 3}" + # For the rest of this scope we need to have the binary loaded. + clean_restart $binfile + # "with" with no command reinvokes the previous command. + gdb_test "print g_s" " = {a = 1, b = 2, c = 3}" gdb_test "with language ada" \ " = \\(a => 1, b => 2, c => 3\\)" \ "reinvoke with language" @@ -202,6 +209,12 @@ with_test_prefix "repeat" { pass $test } } + + # "with" after a non-repeatable command. + gdb_test "display 123" "1: 123 = 123" + gdb_test "with language ada" \ + "No previous command to relaunch" \ + "reinvoke after a non-repeatable command" } # Basic run control. -- 2.26.2