From: Simon Marchi <simon.marchi@polymtl.ca>
To: Luis Machado <lgustavo@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Add -verify option to load command
Date: Fri, 06 Jan 2017 19:59:00 -0000 [thread overview]
Message-ID: <c3fed8cb99ee22e8a75a04517431ed28@polymtl.ca> (raw)
In-Reply-To: <3a9784ff-cae4-f0f0-5209-636ca69dd1d5@codesourcery.com>
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 <offset>" without a symbol file. GDB will complain
> about not finding file <offset>. Sounds like that is another
> improvement.
Indeed, perhaps it should have been an option "-offset <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
prev parent reply other threads:[~2017-01-06 19:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-06 16:42 Luis Machado
2017-01-06 18:17 ` Eli Zaretskii
2017-01-06 18:30 ` Luis Machado
2017-01-07 7:53 ` Eli Zaretskii
2017-01-06 19:17 ` Simon Marchi
2017-01-06 19:33 ` Luis Machado
2017-01-06 19:59 ` Simon Marchi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3fed8cb99ee22e8a75a04517431ed28@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=lgustavo@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox