From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102958 invoked by alias); 30 Nov 2017 15:01:32 -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 102945 invoked by uid 89); 30 Nov 2017 15:01:31 -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= 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 15:01:30 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B970C05689C for ; Thu, 30 Nov 2017 15:01:29 +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 30266620BE; Thu, 30 Nov 2017 15:01:19 +0000 (UTC) Subject: Re: [PATCH v3] Make '{add-,}symbol-file' not care about the position of command line arguments To: Sergio Durigan Junior , GDB Patches References: <20171129214451.14257-1-sergiodj@redhat.com> <20171130133334.13506-1-sergiodj@redhat.com> From: Pedro Alves Message-ID: <48444aaa-b0f4-cf50-8b43-edd1caea4e60@redhat.com> Date: Thu, 30 Nov 2017 15:01: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: <20171130133334.13506-1-sergiodj@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00835.txt.bz2 On 11/30/2017 01:33 PM, Sergio Durigan Junior wrote: > +# Since we're here, might as well test the 'symbol-file' command and > +# if its arguments can also be passed at any position. > +gdb_test "symbol-file -readnow $binfile" \ > + "Reading symbols from ${binfile}\.\.\.expanding to full symbols\.\.\.done\." \ > + "symbol-file with -readnow first" > +clean_restart > +gdb_test "symbol-file $binfile -readnow" \ > + "Reading symbols from ${binfile}\.\.\.expanding to full symbols\.\.\.done\." \ > + "symbol-file with -readnow second" > +gdb_test "symbol-file -readnow" \ > + "no symbol file name was specified" \ > + "symbol-file without filename" > +gdb_test "symbol-file -- non-existent-file" \ > + "non-existent-file: No such file or directory\." \ > + "symbol-file with -- disables option processing" This should be "-non-existent-file", with leading "-" ... Missing the same test with "add-symbol-file". Another thing I wondered is why do we have the expecting_sec_name/expecting_sec_addr variables instead of simply reading the arguments in the argv ahead inline like maintenance_print_symbols does? As is, the patch essentially forbids section names that start with '-': (gdb) add-symbol-file ./gdb 0 -s -funnysection 0 add symbol table from file "./gdb" at .text_addr = 0x0 -funnysection_addr = 0x0 (y or n) => (gdb) add-symbol-file ./gdb 0 -s -funnysection 0 Missing section address after "-s" and I'm not sure that's really a good idea. I don't think we should really interpret/require section names to be in any way/format. (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.) Thanks, Pedro Alves