public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFAv2 00/10] fix/improve cmd structure, class_alias, help, apropos
@ 2020-05-14 21:18 Philippe Waroquiers
  2020-05-14 21:18 ` [RFAv2 01/10] Fix the only incorrect case found by command_structure_invariants selftest Philippe Waroquiers
                   ` (10 more replies)
  0 siblings, 11 replies; 16+ messages in thread
From: Philippe Waroquiers @ 2020-05-14 21:18 UTC (permalink / raw)
  To: gdb-patches

This patch series started with the objective to cleanup the 'class_alias'
usages, so as to have this class only used for user-defined aliases.

While doing the above change, various problems were then discovered in the
command list structure and command help.

So, this patch series fixes these problems, to end up with the
removal of the usage of 'class_alias' for the aliases predefined
by GDB.

Using 'class_alias' only for user-defined aliases was deemed the best approach
to handle the comment of Simon related to "default args for commands and
aliases" that pre-defined commands and aliases should not have their default
changeable via default args. Otherwise, the user would be confused by having
e.g. 'backtrace' and 'bt' behaving differently, while most users
will assume these are the same commands.
So, the patch series "default args for commands and aliases" must differentiate
predefined aliases from user defined aliases, and the idea is to reserve
class_alias for these user-defined aliases.

Note that the concept of command classes in GDB is only used for
the help system:  typing "help" without arguments gives a list of
command classes.  Typing "help <classname>" is (supposed to) list
the commands having that class.

"help aliases" is today giving a very strange functionality.
It only shows a very small subset of the GDB predefined aliases
(e.g. it shows none of the abbreviation aliases) and does
not show some other aliases (such as 'disable breakpoints').
Various other strange behaviour such as: when defining the alias:
   alias deactive = disable
then 'help aliases' shows this new alias (this is normal)
but also starts to show a whole bunch of 'disable' subcommands,
which is all pretty useless in the list of aliases:

  (gdb) help aliases
  Aliases of other commands.

  List of commands:

  deactive -- Disable all or some breakpoints.
  disable breakpoints -- Disable all or some breakpoints.
  disable display -- Disable some expressions to be displayed when program stops.
  disable frame-filter -- GDB command to disable the specified frame-filter.
  ...
So, a bunch of "disable" subcommands are appearing due to that.
It is interesting to try "help aliases" after having done:
  "alias is = info set"

So, the idea is to only show the user defined aliases in "help aliases",
and show the predefined aliases together with the help of the command
they are aliasing.
This is deemed to help the user to see how to use aliases to type faster
the commands they are asking some help for, compared to the current
very partial list of aliases shown by "help aliases".

Note that if deemed necessary, we could implement a (fake) class
  "help predefined-aliases"
that would show the GDB predefined aliases, if ever that would be
deemed needed.

Note also that only remaining usage of 'abbreviation alias' concept is
to avoid completion proposing an abbreviation alias.  The other usage
to not shown an alias in the GDB help system is not needed anymore,
as now aliases and abbreviations are shown as part of the aliased
command help.

This is the version 2 of the patch series.
Compared to the first version, it handles the comments received from
Tom and Eli.



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

end of thread, other threads:[~2020-05-15 20:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 21:18 [RFAv2 00/10] fix/improve cmd structure, class_alias, help, apropos Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 01/10] Fix the only incorrect case found by command_structure_invariants selftest Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 02/10] Add a selftest that detects a 'corrupted' command tree structure in GDB Philippe Waroquiers
2020-05-15 16:37   ` Tom Tromey
2020-05-14 21:18 ` [RFAv2 03/10] Fix problem that alias can be defined or not depending on the order Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 04/10] Fix the problems reported by prefix check of command-def-selftests.c Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 05/10] command-def-selftests.c: detect missing or wrong prefix cmd in subcommands Philippe Waroquiers
2020-05-15 16:37   ` Tom Tromey
2020-05-14 21:18 ` [RFAv2 06/10] Fix inconsistent output of prefix and bugs in 'show' command Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 07/10] Fix/improve 'help CLASS' output Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 08/10] Fix/improve 'apropos' output Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 09/10] Ensure class_alias is only used for user-defined aliases Philippe Waroquiers
2020-05-14 21:18 ` [RFAv2 10/10] Update NEWS and documentation for help and apropos changes Philippe Waroquiers
2020-05-15  6:32   ` Eli Zaretskii
2020-05-15 16:39 ` [RFAv2 00/10] fix/improve cmd structure, class_alias, help, apropos Tom Tromey
2020-05-15 20:46   ` 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).