From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42434 invoked by alias); 30 Nov 2017 17:43:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 42391 invoked by uid 89); 30 Nov 2017 17:43:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=answering X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Nov 2017 17:43:17 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C786A5D687 for ; Thu, 30 Nov 2017 17:43:16 +0000 (UTC) Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A01645D6A9; Thu, 30 Nov 2017 17:43:15 +0000 (UTC) From: Sergio Durigan Junior To: Pedro Alves Cc: GDB Patches Subject: Re: [PATCH v3] Make '{add-,}symbol-file' not care about the position of command line arguments References: <20171129214451.14257-1-sergiodj@redhat.com> <20171130133334.13506-1-sergiodj@redhat.com> <48444aaa-b0f4-cf50-8b43-edd1caea4e60@redhat.com> <87r2sf3cge.fsf@redhat.com> <776d2bfd-fc2c-030c-e277-1461360a54a6@redhat.com> Date: Thu, 30 Nov 2017 17:43:00 -0000 In-Reply-To: <776d2bfd-fc2c-030c-e277-1461360a54a6@redhat.com> (Pedro Alves's message of "Thu, 30 Nov 2017 17:37:45 +0000") Message-ID: <87lgin1x3g.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00847.txt.bz2 On Thursday, November 30 2017, Pedro Alves wrote: > On 11/30/2017 05:26 PM, Sergio Durigan Junior wrote: > >>> (Another thing that I noticed but I'm kind of ignoring is the fact >>> that gdb_test treats the question as optional gdb output, so >>> pedantically gdb could stop outputting the question and answer >>> "n" automatically and the testcase wouldn't notice.) >> >> Would you prefer if I made the tests answer "y" instead? Or maybe I'm >> misunderstanding your concern. >> > > Take a look at how gdb_test implements the question/response. The > question argument is a question that GDB _may_ ask, not one that > GDB _must_ ask. > > So pedantically if add-symbol-file's query ever becomes broken in a way > that makes GDB simply automatically assume "n" without GDB printing > the question in the first place, like: > > (gdb) add-symbol-file -s .text 0x200 $binfile 0x100 > Not confirmed. > (gdb) > > then this: > > gdb_test "add-symbol-file -s .text 0x200 $binfile 0x100" \ > "Not confirmed\." \ > "add-symbol-file different -s .text, before file" \ > "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = x100\r\n\t\.text_addr = 0x200\r\n\\(y or n\\) " \ > "n" > > won't notice it, it'll still PASS. > > The usual way to test must-ask questions is to use > one gdb_test_multiple up to the question, and another gdb_test for > answering the question. Something like (untested): > > set test "add-symbol-file different -s .text, before file" > gdb_test_multiple "add-symbol-file -s .text 0x200 $binfile 0x100" $test { > -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = x100\r\n\t\.text_addr = 0x200\r\n\\(y or n\\) " { > gdb_test "n" "Not confirmed\." $test > } > } OK, I see what you mean. You obviously know that I copied the same pattern present at gdb.base/relocate.exp (and many other tests, which makes me frown a bit when I read "The usual way to test must-ask..."). I'll rewrite my tests to use the suggested way, then. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/