public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>,
	gdb-patches@sourceware.org
Subject: Re: [RFAv7 0/3] Allow the user to define default args for aliases
Date: Sat, 20 Jun 2020 15:24:40 -0400	[thread overview]
Message-ID: <cb44f17b-8955-850b-7ed7-67acec0bec46@simark.ca> (raw)
In-Reply-To: <20200614163942.19176-1-philippe.waroquiers@skynet.be>

On 2020-06-14 12:39 p.m., Philippe Waroquiers via Gdb-patches wrote:
> Allow the user to define default args for user-defined aliases.
> 
> This is version 7 of the patch series.
> Compared to version 6, it implements the prevention of
> defining an alias of an alias having default args, as suggested
> by Simon.

Huh, I just realized it's still possible to get into that situation
because of the "set default-args" command:

(gdb) alias aaa = backtrace
(gdb) alias bbb = aaa -past-main
(gdb) set default-args aaa -full

With the current implementation where default args are resolved at define
time, `bbb` will only have `-past-main` as its default args.  But if we
later implement the feature where default args are resolved at use time,
that behavior will change.

I kind of feel like the bad guy because I keep suggesting to reduce the
scope of the feature but... is there a good use case at the moment for
"set default-args", compared to passing default args when defining the
alias?  A use case where you wouldn't know the default args before
defining the alias?  If not, removing "set default-args" would avoid it,
without loss of functionality.  Then we'd have to see if
"show default-args" makes sense without "set default-args".  It's still
possible to see the default args with "help <alias>".

That would make me feel comfortable enough about the feature to merge
it in time for GDB 10.  It is restricted enough that there's not much
risk of introducing a behavior we'll regret later, while still adding
something that has value, being able to add default args to aliases.

Once we have evaluation of default args at runtime, I think it would
be fine to have "set default-args", if you think it's useful.  Using it
on a command X would implicitly affect all the aliases based on X, which
is what I would expect as a user.

Simon

  parent reply	other threads:[~2020-06-20 19:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14 16:39 Philippe Waroquiers
2020-06-14 16:39 ` [RFAv7 1/3] default-args: allow to define default arguments " Philippe Waroquiers
2020-06-20 19:26   ` Simon Marchi
2020-06-14 16:39 ` [RFAv7 2/3] Add tests for new default-args related commands and arguments Philippe Waroquiers
2020-06-14 16:39 ` [RFAv7 3/3] NEWS and documentation for default-args related concept and commands Philippe Waroquiers
2020-06-20 19:24 ` Simon Marchi [this message]
2020-06-21 11:48   ` [RFAv7 0/3] Allow the user to define default args for aliases Philippe Waroquiers

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=cb44f17b-8955-850b-7ed7-67acec0bec46@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).