From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114904 invoked by alias); 30 Nov 2017 12:49:01 -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 114555 invoked by uid 89); 30 Nov 2017 12:49:01 -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 12:49:00 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 09F275F7BB for ; Thu, 30 Nov 2017 12:48:59 +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 6BD9C5C88D; Thu, 30 Nov 2017 12:48:56 +0000 (UTC) Subject: Re: [PATCH v2] Make '{add-,}symbol-file' not care about the position of command line arguments To: Sergio Durigan Junior References: <20171129214451.14257-1-sergiodj@redhat.com> <20171130042448.30882-1-sergiodj@redhat.com> <2fba79f1-e16e-38f2-bc0f-1c27da05e5c1@redhat.com> <87po807xhu.fsf@redhat.com> Cc: GDB Patches From: Pedro Alves Message-ID: Date: Thu, 30 Nov 2017 12:49: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: <87po807xhu.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00830.txt.bz2 On 11/30/2017 12:38 PM, Sergio Durigan Junior wrote: > On Thursday, November 30 2017, Pedro Alves wrote: > >> On 11/30/2017 04:24 AM, Sergio Durigan Junior wrote: >>> Changes from v1: >>> >>> - Commit message has been rewritten. >>> >>> - Implemented position-independent argument parsing for >>> 'add-symbol-file'. >>> >>> - Added testcases. >> >> Looks like you missed the comment about "--". Take a look at >> maintenance_print_symbols for an example of a command >> that supports ending options with "--". Can you add that >> while you're at it, please? For a test, I'd suggest >> e.g., "symbol-file -- -non-existent-file" and confirming >> gdb errors out. That's simpler than actually creating a file. > > Oh, I didn't understand that you were asking me to implement it. I > thought it was a comment for "something to be done later". I'll do it, > then. I'd rather do it at the same time because there's the possibility that implementing it suggests implementing any-position arguments differently. Or maybe not. But I'd rather that we didn't have to redo any-position support later on again. >> >> Does this push_back directly here mean that these >> two commands end up with different semantics? >> >> (gdb) add-symbol-file FILE 0 -s .text 0x1000 >> (gdb) add-symbol-file -s .text 0x1000 FILE 0 > > The arguments are printed in a different order, yes: > > (gdb) add-symbol-file -s .text 0x100 ./gdb/testsuite/outputs/gdb.base/relocate/relocate.o 0 > add symbol table from file "./gdb/testsuite/outputs/gdb.base/relocate/relocate.o" at > .text_addr = 0x100 > .text_addr = 0x0 > (y or n) n > Not confirmed. > (gdb) add-symbol-file ./gdb/testsuite/outputs/gdb.base/relocate/relocate.o 0 -s .text 0x100 > add symbol table from file "./gdb/testsuite/outputs/gdb.base/relocate/relocate.o" at > .text_addr = 0x0 > .text_addr = 0x100 > (y or n) n > Not confirmed. > >> Not sure that's a good idea. > > I'll work on it and make sure they're always printed in the same way. TBC, the worry was not really about the printing (that's minor), but what is the actual resulting .text address that the symbol file it loaded at in the end. But sounds like the printing order can be used as proxy for checking that. It's not as robust as actually loading the symbols and then checking what happened (with e.g., printing a symbol's address), but it's good enough. Thanks, Pedro Alves