mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:54:41 +08:00
Ensure class_alias is only used for user-defined aliases.
This commit finally does the (small) change that started this patch series. It ensures that the class_alias is only used for user-defined aliases. So, the few GDB pre-defined aliases that were using the 'class_alias' class are now using a real help class, typically the class of the aliased command. gdb/ChangeLog 2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be> * command.h (enum command_class): Improve comments, document that class_alias is for user-defined aliases, give the class name for each class, remove unused class_xdb. * cli/cli-decode.c (add_com_alias): Document THECLASS intended usage. * breakpoint.c (_initialize_breakpoint): Replace class_alias by a precise class. * infcmd.c (_initialize_infcmd): Likewise. * reverse.c (_initialize_reverse): Likewise. * stack.c (_initialize_stack): Likewise. * symfile.c (_initialize_symfile): Likewise. * tracepoint.c (_initialize_tracepoint): Likewise. gdb/testsuite/ChangeLog 2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/alias.exp: Verify 'help aliases' shows user defined aliases.
This commit is contained in:
parent
7c05caf72d
commit
57b4f16e49
@ -1,3 +1,17 @@
|
||||
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
|
||||
* command.h (enum command_class): Improve comments, document
|
||||
that class_alias is for user-defined aliases, give the class
|
||||
name for each class, remove unused class_xdb.
|
||||
* cli/cli-decode.c (add_com_alias): Document THECLASS intended usage.
|
||||
* breakpoint.c (_initialize_breakpoint): Replace class_alias
|
||||
by a precise class.
|
||||
* infcmd.c (_initialize_infcmd): Likewise.
|
||||
* reverse.c (_initialize_reverse): Likewise.
|
||||
* stack.c (_initialize_stack): Likewise.
|
||||
* symfile.c (_initialize_symfile): Likewise.
|
||||
* tracepoint.c (_initialize_tracepoint): Likewise.
|
||||
|
||||
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
|
||||
* cli/cli-decode.c (apropos_cmd): Produce output for aliases
|
||||
|
@ -15478,7 +15478,7 @@ A disabled breakpoint is not forgotten, but has no effect until re-enabled."),
|
||||
add_com_alias ("dis", "disable", class_breakpoint, 1);
|
||||
add_com_alias ("disa", "disable", class_breakpoint, 1);
|
||||
|
||||
add_cmd ("breakpoints", class_alias, disable_command, _("\
|
||||
add_cmd ("breakpoints", class_breakpoint, disable_command, _("\
|
||||
Disable all or some breakpoints.\n\
|
||||
Usage: disable breakpoints [BREAKPOINTNUM]...\n\
|
||||
Arguments are breakpoint numbers with spaces in between.\n\
|
||||
@ -15498,7 +15498,7 @@ Also a prefix command for deletion of other GDB objects."),
|
||||
add_com_alias ("d", "delete", class_breakpoint, 1);
|
||||
add_com_alias ("del", "delete", class_breakpoint, 1);
|
||||
|
||||
add_cmd ("breakpoints", class_alias, delete_command, _("\
|
||||
add_cmd ("breakpoints", class_breakpoint, delete_command, _("\
|
||||
Delete all or some breakpoints or auto-display expressions.\n\
|
||||
Usage: delete breakpoints [BREAKPOINTNUM]...\n\
|
||||
Arguments are breakpoint numbers with spaces in between.\n\
|
||||
@ -15686,10 +15686,10 @@ BREAK_ARGS_HELP ("trace") "\n\
|
||||
Do \"help tracepoints\" for info on other tracepoint commands."));
|
||||
set_cmd_completer (c, location_completer);
|
||||
|
||||
add_com_alias ("tp", "trace", class_alias, 0);
|
||||
add_com_alias ("tr", "trace", class_alias, 1);
|
||||
add_com_alias ("tra", "trace", class_alias, 1);
|
||||
add_com_alias ("trac", "trace", class_alias, 1);
|
||||
add_com_alias ("tp", "trace", class_breakpoint, 0);
|
||||
add_com_alias ("tr", "trace", class_breakpoint, 1);
|
||||
add_com_alias ("tra", "trace", class_breakpoint, 1);
|
||||
add_com_alias ("trac", "trace", class_breakpoint, 1);
|
||||
|
||||
c = add_com ("ftrace", class_breakpoint, ftrace_command, _("\
|
||||
Set a fast tracepoint at specified location.\n\
|
||||
|
@ -1006,7 +1006,10 @@ add_com (const char *name, enum command_class theclass,
|
||||
return add_cmd (name, theclass, fun, doc, &cmdlist);
|
||||
}
|
||||
|
||||
/* Add an alias or abbreviation command to the list of commands. */
|
||||
/* Add an alias or abbreviation command to the list of commands.
|
||||
For aliases predefined by GDB (such as bt), THECLASS must be
|
||||
different of class_alias, as class_alias is used to identify
|
||||
user defined aliases. */
|
||||
|
||||
struct cmd_list_element *
|
||||
add_com_alias (const char *name, const char *oldname, enum command_class theclass,
|
||||
|
@ -29,21 +29,46 @@ struct completion_tracker;
|
||||
/* Command classes are top-level categories into which commands are
|
||||
broken down for "help" purposes.
|
||||
|
||||
Notes on classes: class_alias is for alias commands which are not
|
||||
abbreviations of the original command. class-pseudo is for
|
||||
commands which are not really commands nor help topics ("stop"). */
|
||||
The class_alias is used for the user-defined aliases, defined
|
||||
using the "alias" command.
|
||||
|
||||
Aliases pre-defined by GDB (e.g. the alias "bt" of the "backtrace" command)
|
||||
are not using the class_alias.
|
||||
Different pre-defined aliases of the same command do not necessarily
|
||||
have the same classes. For example, class_stack is used for the
|
||||
"backtrace" and its "bt" alias", while "info stack" (also an alias
|
||||
of "backtrace" uses class_info. */
|
||||
|
||||
enum command_class
|
||||
{
|
||||
/* Special args to help_list */
|
||||
class_deprecated = -3, all_classes = -2, all_commands = -1,
|
||||
/* Classes of commands followed by a comment giving the name
|
||||
to use in "help <classname>".
|
||||
Note that help accepts unambiguous abbreviated class names. */
|
||||
|
||||
/* Special classes to help_list */
|
||||
class_deprecated = -3,
|
||||
all_classes = -2, /* help without <classname> */
|
||||
all_commands = -1, /* all */
|
||||
|
||||
/* Classes of commands */
|
||||
no_class = -1, class_run = 0, class_vars, class_stack, class_files,
|
||||
class_support, class_info, class_breakpoint, class_trace,
|
||||
class_alias, class_bookmark, class_obscure, class_maintenance,
|
||||
class_tui, class_user, class_xdb,
|
||||
no_set_class /* Used for "show" commands that have no corresponding
|
||||
"set" command. */
|
||||
no_class = -1,
|
||||
class_run = 0, /* running */
|
||||
class_vars, /* data */
|
||||
class_stack, /* stack */
|
||||
class_files, /* files */
|
||||
class_support, /* support */
|
||||
class_info, /* status */
|
||||
class_breakpoint, /* breakpoints */
|
||||
class_trace, /* tracepoints */
|
||||
class_alias, /* aliases */
|
||||
class_bookmark,
|
||||
class_obscure, /* obscure */
|
||||
class_maintenance, /* internals */
|
||||
class_tui,
|
||||
class_user, /* user-defined */
|
||||
|
||||
/* Used for "show" commands that have no corresponding "set" command. */
|
||||
no_set_class
|
||||
};
|
||||
|
||||
/* FIXME: cagney/2002-03-17: Once cmd_type() has been removed, ``enum
|
||||
|
@ -3180,7 +3180,7 @@ is restored."),
|
||||
cmd_name = "inferior-tty";
|
||||
c = lookup_cmd (&cmd_name, setlist, "", -1, 1);
|
||||
gdb_assert (c != NULL);
|
||||
add_alias_cmd ("tty", c, class_alias, 0, &cmdlist);
|
||||
add_alias_cmd ("tty", c, class_run, 0, &cmdlist);
|
||||
|
||||
cmd_name = "args";
|
||||
add_setshow_string_noescape_cmd (cmd_name, class_run,
|
||||
@ -3318,14 +3318,14 @@ Step one instruction exactly.\n\
|
||||
Usage: stepi [N]\n\
|
||||
Argument N means step N times (or till program stops for another \
|
||||
reason)."));
|
||||
add_com_alias ("si", "stepi", class_alias, 0);
|
||||
add_com_alias ("si", "stepi", class_run, 0);
|
||||
|
||||
add_com ("nexti", class_run, nexti_command, _("\
|
||||
Step one instruction, but proceed through subroutine calls.\n\
|
||||
Usage: nexti [N]\n\
|
||||
Argument N means step N times (or till program stops for another \
|
||||
reason)."));
|
||||
add_com_alias ("ni", "nexti", class_alias, 0);
|
||||
add_com_alias ("ni", "nexti", class_run, 0);
|
||||
|
||||
add_com ("finish", class_run, finish_command, _("\
|
||||
Execute until selected stack frame returns.\n\
|
||||
|
@ -330,7 +330,7 @@ _initialize_reverse ()
|
||||
Step program backward until it reaches the beginning of another source line.\n\
|
||||
Argument N means do this N times (or till program stops for another reason).")
|
||||
);
|
||||
add_com_alias ("rs", "reverse-step", class_alias, 1);
|
||||
add_com_alias ("rs", "reverse-step", class_run, 1);
|
||||
|
||||
add_com ("reverse-next", class_run, reverse_next, _("\
|
||||
Step program backward, proceeding through subroutine calls.\n\
|
||||
@ -338,26 +338,26 @@ Like the \"reverse-step\" command as long as subroutine calls do not happen;\n\
|
||||
when they do, the call is treated as one instruction.\n\
|
||||
Argument N means do this N times (or till program stops for another reason).")
|
||||
);
|
||||
add_com_alias ("rn", "reverse-next", class_alias, 1);
|
||||
add_com_alias ("rn", "reverse-next", class_run, 1);
|
||||
|
||||
add_com ("reverse-stepi", class_run, reverse_stepi, _("\
|
||||
Step backward exactly one instruction.\n\
|
||||
Argument N means do this N times (or till program stops for another reason).")
|
||||
);
|
||||
add_com_alias ("rsi", "reverse-stepi", class_alias, 0);
|
||||
add_com_alias ("rsi", "reverse-stepi", class_run, 0);
|
||||
|
||||
add_com ("reverse-nexti", class_run, reverse_nexti, _("\
|
||||
Step backward one instruction, but proceed through called subroutines.\n\
|
||||
Argument N means do this N times (or till program stops for another reason).")
|
||||
);
|
||||
add_com_alias ("rni", "reverse-nexti", class_alias, 0);
|
||||
add_com_alias ("rni", "reverse-nexti", class_run, 0);
|
||||
|
||||
add_com ("reverse-continue", class_run, reverse_continue, _("\
|
||||
Continue program being debugged but run it in reverse.\n\
|
||||
If proceeding from breakpoint, a number N may be used as an argument,\n\
|
||||
which means to set the ignore count of that breakpoint to N - 1 (so that\n\
|
||||
the breakpoint won't break until the Nth time it is reached)."));
|
||||
add_com_alias ("rc", "reverse-continue", class_alias, 0);
|
||||
add_com_alias ("rc", "reverse-continue", class_run, 0);
|
||||
|
||||
add_com ("reverse-finish", class_run, reverse_finish, _("\
|
||||
Execute backward until just before selected stack frame is called."));
|
||||
|
@ -3485,7 +3485,7 @@ With a negative COUNT, print outermost -COUNT frames."),
|
||||
|
||||
add_com_alias ("bt", "backtrace", class_stack, 0);
|
||||
|
||||
add_com_alias ("where", "backtrace", class_alias, 0);
|
||||
add_com_alias ("where", "backtrace", class_stack, 0);
|
||||
add_info ("stack", backtrace_command,
|
||||
_("Backtrace of the stack, or innermost COUNT frames."));
|
||||
add_info_alias ("s", "stack", 1);
|
||||
|
@ -3906,8 +3906,8 @@ on its own."), &cmdlist);
|
||||
_("Commands for debugging overlays."), &overlaylist,
|
||||
"overlay ", 0, &cmdlist);
|
||||
|
||||
add_com_alias ("ovly", "overlay", class_alias, 1);
|
||||
add_com_alias ("ov", "overlay", class_alias, 1);
|
||||
add_com_alias ("ovly", "overlay", class_support, 1);
|
||||
add_com_alias ("ov", "overlay", class_support, 1);
|
||||
|
||||
add_cmd ("map-overlay", class_support, map_overlay_command,
|
||||
_("Assert that an overlay section is mapped."), &overlaylist);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
|
||||
* gdb.base/alias.exp: Verify 'help aliases' shows user defined aliases.
|
||||
|
||||
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
|
||||
* gdb.base/help.exp: Test apropos and help for commands
|
||||
@ -8,7 +12,7 @@
|
||||
|
||||
* gdb.base/alias.exp: Update help output check.
|
||||
|
||||
c2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
|
||||
* gdb.base/default.exp: Update output following fixes.
|
||||
|
||||
|
@ -122,3 +122,6 @@ gdb_test_no_output "alias abcd = backtrace"
|
||||
gdb_test_no_output "alias abcde = backtrace"
|
||||
gdb_test_no_output "alias fghij = backtrace"
|
||||
gdb_test_no_output "alias fghi = backtrace"
|
||||
|
||||
# Verify help aliases shows the user defined aliases
|
||||
gdb_test "help aliases" ".*abcd --.*.*abcde --.*"
|
||||
|
@ -4098,8 +4098,8 @@ one or more \"collect\" commands, to specify what to collect\n\
|
||||
while single-stepping.\n\n\
|
||||
Note: this command can only be used in a tracepoint \"actions\" list."));
|
||||
|
||||
add_com_alias ("ws", "while-stepping", class_alias, 0);
|
||||
add_com_alias ("stepping", "while-stepping", class_alias, 0);
|
||||
add_com_alias ("ws", "while-stepping", class_trace, 0);
|
||||
add_com_alias ("stepping", "while-stepping", class_trace, 0);
|
||||
|
||||
add_com ("collect", class_trace, collect_pseudocommand, _("\
|
||||
Specify one or more data items to be collected at a tracepoint.\n\
|
||||
|
Loading…
Reference in New Issue
Block a user