public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFAv5 0/3] Allow the user to define default args for commands and aliases
@ 2020-03-07 13:14 Philippe Waroquiers
  2020-03-07 13:14 ` [RFAv5 1/3] default-args: allow to define default command/alias arguments Philippe Waroquiers
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Philippe Waroquiers @ 2020-03-07 13:14 UTC (permalink / raw)
  To: gdb-patches

Allow the user to define default args for commands and aliases.

This patch series implements, tests and documents the following commands:

  set default-args COMMAND [DEFAULT-ARGS...]
  show default-args [COMMAND]
  set enable-default-args [on|off]
  show enable-default-args


It also changes the alias command to be:
  alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]


Using the above default-args commands and arguments, you can
define default arguments for commands or define powerful aliases.

For example:

  alias bt_ALL = backtrace -entry-values both -frame-arg all -past-main -past-entry -full

defines the alias bt_ALL that will give as much information as possible
in a backtrace.

Default args can usefully be combined with the 'with' command, such as:

Make "wLapPeu" an alias of 2 nested "with":
  alias wLapPeu = with language pascal -- with print elements unlimited --

or have an alias pp10 to pretty print an expression with a maximum of
10 elements:

  alias pp10 = with print pretty -- with print elem 10 -- print

This patch series also adds a completer for 'alias'.


This is the version 5 of the patch series.
Compared the version 4, the changes are handling the comments of
Christian and Eli:
  * Declarations are moved close to their first use.
  * strchr (text, '='); used instead of strstr.
  * More consistent use of nullptr instead of NULL
  * std::string default_args used instead of const char *default_args
  * Updated/clarified NEWS and gdb.texinfo, as commented by Eli.

Previous versions handled various comments of Pedro and Tom.

For what concerns changing 'alias -a' to 'alias -abbreviation":
This can for sure be done (and be backward compatible).  This can however
be done as a separate patch (I still also need to do a similar change
for the 'qcs' flags).

Note 1: a preliminary version of this idea (using a command called
'add-args') was discussed in
https://sourceware.org/ml/gdb-patches/2019-06/msg00395.html
where Tom suggested to make it more GDB like, using 'set' command.

Note 2: Following another comment of Tom, there is no '=' character
to separate COMMAND from its default args.
If ever this would be ambiguous in some cases, we could introduce
an optional '=' character to separate COMMAND from its DEFAULT-ARGS.
Similarly, the alias command has no separator between COMMAND
and its DEFAULT-ARGS.




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-30  2:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-07 13:14 [RFAv5 0/3] Allow the user to define default args for commands and aliases Philippe Waroquiers
2020-03-07 13:14 ` [RFAv5 1/3] default-args: allow to define default command/alias arguments Philippe Waroquiers
2020-03-29 15:29   ` Simon Marchi
2020-03-30  2:14   ` Simon Marchi
2020-03-07 13:14 ` [RFAv5 2/3] Add tests for new default-args related commands and arguments Philippe Waroquiers
2020-03-07 13:14 ` [RFAv5 3/3] NEWS and documentation for default-args related concept and commands Philippe Waroquiers
2020-03-07 14:37   ` Eli Zaretskii
2020-03-15 13:14 ` PING. Re: [RFAv5 0/3] Allow the user to define default args for commands and aliases Philippe Waroquiers
2020-03-22 18:05   ` PING^2. " Philippe Waroquiers
2020-03-29 13:45     ` PING^3. " Philippe Waroquiers

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).