From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18493 invoked by alias); 6 Jan 2017 19:59:55 -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 18472 invoked by uid 89); 6 Jan 2017 19:59:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=wheel, (unknown), H*f:sk:3a9784f, ALPHA X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jan 2017 19:59:52 +0000 Received: by simark.ca (Postfix, from userid 33) id 11E571E809; Fri, 6 Jan 2017 14:59:51 -0500 (EST) To: Luis Machado Subject: Re: [PATCH] Add -verify option to load command X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 06 Jan 2017 19:59:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <3a9784ff-cae4-f0f0-5209-636ca69dd1d5@codesourcery.com> References: <1483720912-6563-1-git-send-email-lgustavo@codesourcery.com> <01a92fce926525df375f1317da45e2df@polymtl.ca> <3a9784ff-cae4-f0f0-5209-636ca69dd1d5@codesourcery.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00115.txt.bz2 On 2017-01-06 14:32, Luis Machado wrote: >> From what I understand it is possible to use load without specifying >> FILE, which will load the executable currently loaded in gdb. So I >> think all these forms should be valid: >> > > I notice the current way load works is slightly off. For example, you > can't do "load " without a symbol file. GDB will complain > about not finding file . Sounds like that is another > improvement. Indeed, perhaps it should have been an option "-offset ". >> (gdb) load -verify >> (gdb) load myfile >> (gdb) load -verify myfile >> (gdb) load myfile myoffset >> (gdb) load -verify myfile myoffset >> >> Ideally, we should be able to place the "dash" arguments anywhere, >> just >> like with any good command line tool. Since we don't have that, I >> think >> that having between the command and the positional arguments makes >> more >> sense. That's my opinion though, I'm curious to hear what others >> think. >> > > I'm fine with whatever positioning is deemed appropriate. Personally, > i like the -verify at the end. :-) The problem with at the end is that it's harder to handle when you also have a variable number of positional arguments. For example, if you had: mycommand [-foo|-bar|-baz] ALPHA [BETA] [GAMMA] where you can have one or more of -foo/-bar-baz, one required argument ALPHA and two optional positional arguments BETA and GAMMA. With this form, it's easy to take care of -foo/-bar/-baz. As soon as you have an argument that doesn't match those, the rest of argv is the positional arguments (possibly with -- if you wanted to be able to pass -foo as the ALPHA parameter). If they were at the end like so: mycommand ALPHA [BETA] [GAMMA] [-foo|-bar|-baz] it becomes difficult to determine whether the argument that follows ALPHA is BETA or one of -foo/-bar/-baz... Anyway, the real solution would be to use an appropriate argument parsing library, so we wouldn't have to reinvent the wheel for every command, and maybe have some automatically generated help message. Crazy stuff :). Thanks, Simon