From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33763 invoked by alias); 30 Nov 2017 17:37:51 -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 33744 invoked by uid 89); 30 Nov 2017 17:37:50 -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:37:49 +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 7FC1C61479 for ; Thu, 30 Nov 2017 17:37:48 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB2245D6A3; Thu, 30 Nov 2017 17:37:45 +0000 (UTC) Subject: Re: [PATCH v3] Make '{add-,}symbol-file' not care about the position of command line arguments To: Sergio Durigan Junior References: <20171129214451.14257-1-sergiodj@redhat.com> <20171130133334.13506-1-sergiodj@redhat.com> <48444aaa-b0f4-cf50-8b43-edd1caea4e60@redhat.com> <87r2sf3cge.fsf@redhat.com> Cc: GDB Patches From: Pedro Alves Message-ID: <776d2bfd-fc2c-030c-e277-1461360a54a6@redhat.com> Date: Thu, 30 Nov 2017 17:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <87r2sf3cge.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00845.txt.bz2 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 } } Thanks, Pedro Alves