[binutils-gdb] gdb: add "exit" command as an alias for "quit"

Joel Brobecker brobecke@sourceware.org
Sat Dec 18 11:21:36 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fa8f0a0ff050352eb70ad7ccbcec87f99ced51e7

commit fa8f0a0ff050352eb70ad7ccbcec87f99ced51e7
Author: Enze Li <lienze2010@hotmail.com>
Date:   Sat Dec 18 15:19:12 2021 +0400

    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

Diff:
---
 gdb/NEWS            |  4 ++++
 gdb/cli/cli-cmds.c  |  3 ++-
 gdb/doc/gdb.texinfo | 15 +++++++++------
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 3f78ace82bb..935a10c91eb 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -56,6 +56,10 @@ set logging enabled on|off
 show logging enabled
   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
 
 maint packet
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 3fe47940076..eca92ef71d4 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2445,7 +2445,7 @@ strict == evaluate script according to filename extension, error if not supporte
   cmd_list_element *quit_cmd
     = add_com ("quit", class_support, quit_command, _("\
 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\
 used as GDB's exit code.  The default is zero."));
   cmd_list_element *help_cmd
@@ -2453,6 +2453,7 @@ used as GDB's exit code.  The default is zero."));
 	       _("Print list of commands."));
   set_cmd_completer (help_cmd, command_completer);
   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_setshow_boolean_cmd ("verbose", class_support, &info_verbose, _("\
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index d0c5bcf18e1..0c517b464d8 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -841,7 +841,7 @@ The essentials are:
 @item
 type @samp{@value{GDBP}} to start @value{GDBN}.
 @item
-type @kbd{quit} or @kbd{Ctrl-d} to exit.
+type @kbd{quit}, @kbd{exit} or @kbd{Ctrl-d} to exit.
 @end itemize
 
 @menu
@@ -1580,14 +1580,16 @@ Options,,Choosing Modes}.
 
 @table @code
 @kindex quit @r{[}@var{expression}@r{]}
+@kindex exit @r{[}@var{expression}@r{]}
 @kindex q @r{(@code{quit})}
 @item quit @r{[}@var{expression}@r{]}
+@itemx exit @r{[}@var{expression}@r{]}
 @itemx q
 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
-do not supply @var{expression}, @value{GDBN} will terminate normally;
-otherwise it will terminate using the result of @var{expression} as the
-error code.
+@code{q}), the @code{exit} command, or type an end-of-file
+character (usually @kbd{Ctrl-d}).  If you do not supply @var{expression},
+@value{GDBN} will terminate normally; otherwise it will terminate using
+the result of @var{expression} as the error code.
 @end table
 
 @cindex interrupt
@@ -47253,7 +47255,7 @@ Modula-2.
 
 @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}
-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}.
 
 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}.
 
 @item quit
+@itemx exit
 Exit from @value{GDBN}.
 @end table


More information about the Gdb-cvs mailing list