gdb: add "exit" command as an alias for "quit"

This command adds the "exit" command as an alias for the "quit"
command, as requested in PR gdb/28406.

The documentation is also updated to mention this new command.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28406
This commit is contained in:
Enze Li 2021-12-18 15:19:12 +04:00 committed by Joel Brobecker
parent 8d34471f70
commit fa8f0a0ff0
3 changed files with 15 additions and 7 deletions

View file

@ -56,6 +56,10 @@ set logging enabled on|off
show logging enabled show logging enabled
These commands set or show whether logging is enabled or disabled. These commands set or show whether logging is enabled or disabled.
exit
You can now exit GDB by using the new command "exit", in addition to
the existing "quit" command.
* Changed commands * Changed commands
maint packet maint packet

View file

@ -2445,7 +2445,7 @@ strict == evaluate script according to filename extension, error if not supporte
cmd_list_element *quit_cmd cmd_list_element *quit_cmd
= add_com ("quit", class_support, quit_command, _("\ = add_com ("quit", class_support, quit_command, _("\
Exit gdb.\n\ Exit gdb.\n\
Usage: quit [EXPR]\n\ Usage: quit [EXPR] or exit [EXPR]\n\
The optional expression EXPR, if present, is evaluated and the result\n\ The optional expression EXPR, if present, is evaluated and the result\n\
used as GDB's exit code. The default is zero.")); used as GDB's exit code. The default is zero."));
cmd_list_element *help_cmd cmd_list_element *help_cmd
@ -2453,6 +2453,7 @@ used as GDB's exit code. The default is zero."));
_("Print list of commands.")); _("Print list of commands."));
set_cmd_completer (help_cmd, command_completer); set_cmd_completer (help_cmd, command_completer);
add_com_alias ("q", quit_cmd, class_support, 1); add_com_alias ("q", quit_cmd, class_support, 1);
add_com_alias ("exit", quit_cmd, class_support, 1);
add_com_alias ("h", help_cmd, class_support, 1); add_com_alias ("h", help_cmd, class_support, 1);
add_setshow_boolean_cmd ("verbose", class_support, &info_verbose, _("\ add_setshow_boolean_cmd ("verbose", class_support, &info_verbose, _("\

View file

@ -841,7 +841,7 @@ The essentials are:
@item @item
type @samp{@value{GDBP}} to start @value{GDBN}. type @samp{@value{GDBP}} to start @value{GDBN}.
@item @item
type @kbd{quit} or @kbd{Ctrl-d} to exit. type @kbd{quit}, @kbd{exit} or @kbd{Ctrl-d} to exit.
@end itemize @end itemize
@menu @menu
@ -1580,14 +1580,16 @@ Options,,Choosing Modes}.
@table @code @table @code
@kindex quit @r{[}@var{expression}@r{]} @kindex quit @r{[}@var{expression}@r{]}
@kindex exit @r{[}@var{expression}@r{]}
@kindex q @r{(@code{quit})} @kindex q @r{(@code{quit})}
@item quit @r{[}@var{expression}@r{]} @item quit @r{[}@var{expression}@r{]}
@itemx exit @r{[}@var{expression}@r{]}
@itemx q @itemx q
To exit @value{GDBN}, use the @code{quit} command (abbreviated To exit @value{GDBN}, use the @code{quit} command (abbreviated
@code{q}), or type an end-of-file character (usually @kbd{Ctrl-d}). If you @code{q}), the @code{exit} command, or type an end-of-file
do not supply @var{expression}, @value{GDBN} will terminate normally; character (usually @kbd{Ctrl-d}). If you do not supply @var{expression},
otherwise it will terminate using the result of @var{expression} as the @value{GDBN} will terminate normally; otherwise it will terminate using
error code. the result of @var{expression} as the error code.
@end table @end table
@cindex interrupt @cindex interrupt
@ -47253,7 +47255,7 @@ Modula-2.
@value{GDBN} is invoked with the shell command @code{gdb}. Once started, it reads @value{GDBN} is invoked with the shell command @code{gdb}. Once started, it reads
commands from the terminal until you tell it to exit with the @value{GDBN} commands from the terminal until you tell it to exit with the @value{GDBN}
command @code{quit}. You can get online help from @value{GDBN} itself command @code{quit} or @code{exit}. You can get online help from @value{GDBN} itself
by using the command @code{help}. by using the command @code{help}.
You can run @code{gdb} with no arguments or options; but the most You can run @code{gdb} with no arguments or options; but the most
@ -47320,6 +47322,7 @@ Show information about @value{GDBN} command @var{name}, or general information
about using @value{GDBN}. about using @value{GDBN}.
@item quit @item quit
@itemx exit
Exit from @value{GDBN}. Exit from @value{GDBN}.
@end table @end table