From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11965 invoked by alias); 30 Nov 2017 17:26:13 -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 11952 invoked by uid 89); 30 Nov 2017 17:26:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,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 17:26:11 +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 4E7DC5D9E2 for ; Thu, 30 Nov 2017 17:26:10 +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 2445D5D6A3; Thu, 30 Nov 2017 17:26:10 +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> Date: Thu, 30 Nov 2017 17:26:00 -0000 In-Reply-To: <48444aaa-b0f4-cf50-8b43-edd1caea4e60@redhat.com> (Pedro Alves's message of "Thu, 30 Nov 2017 15:01:19 +0000") Message-ID: <87r2sf3cge.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/msg00844.txt.bz2 On Thursday, November 30 2017, Pedro Alves wrote: > 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". Right, fixed. > 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. I agree; I hadn't thought of this case before. I implemented the argument reading ahead, as proposed. > (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. 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/