public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2][PR 28406] gdb: add exit command as an alias for quit
       [not found] <20211113120413.21486-2-lienze2010@hotmail.com>
@ 2021-11-13 12:08 ` Enze Li
       [not found] ` <20211113120855.21949-1-lienze2010@hotmail.com>
  1 sibling, 0 replies; 12+ messages in thread
From: Enze Li @ 2021-11-13 12:08 UTC (permalink / raw)
  To: gdb-patches

As described in PR28406, I think it is a good idea to add an exit command.
Many years ago, when I used the gdb debugger for the first time, I often
input the "quit" command incorrectly. Adding this "exit" command may be
friendly to new users, regardless of whether they have used other similar
software before.

The specific implementation of this idea is simple, only using the
add_com_alias method. Eventually, the quit_cmd function will be invoked.

Enze Li (2):
  gdb: improve quit command with an alias called exit
  gdb/doc: Document the exit command

 gdb/cli/cli-cmds.c  |  3 ++-
 gdb/doc/gdb.texinfo | 15 +++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

-- 
2.33.1


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

* [PATCH 1/2] gdb: improve quit command with an alias called exit
       [not found] ` <20211113120855.21949-1-lienze2010@hotmail.com>
@ 2021-11-13 12:08   ` Enze Li
  2021-11-23 14:21     ` [PING] " Enze Li
  2021-11-13 12:08   ` [PATCH 2/2] gdb/doc: Document the exit command Enze Li
  1 sibling, 1 reply; 12+ messages in thread
From: Enze Li @ 2021-11-13 12:08 UTC (permalink / raw)
  To: gdb-patches

This commit implements a request to add a quit command alias in
PR28406[1]. With this commit, we can now use the "exit" alias
to exit the GDB.

Tested on x86_64-linux.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=28406
---
 gdb/cli/cli-cmds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 2cf614c8e7e..832c9e56937 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2377,7 +2377,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
@@ -2385,6 +2385,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, _("\
-- 
2.33.1


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

* [PATCH 2/2] gdb/doc: Document the exit command
       [not found] ` <20211113120855.21949-1-lienze2010@hotmail.com>
  2021-11-13 12:08   ` [PATCH 1/2] gdb: improve quit command with an alias called exit Enze Li
@ 2021-11-13 12:08   ` Enze Li
  2021-11-13 13:39     ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Enze Li @ 2021-11-13 12:08 UTC (permalink / raw)
  To: gdb-patches

Update "Quitting GDB" section.

	* gdb/doc/gdb.texinfo: (Quitting GDB): Document "exit".
---
 gdb/doc/gdb.texinfo | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index fc8e5bdf3db..153a4b0dfd7 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
@@ -47212,7 +47214,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
@@ -47279,6 +47281,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
 
-- 
2.33.1


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

* Re: [PATCH 2/2] gdb/doc: Document the exit command
  2021-11-13 12:08   ` [PATCH 2/2] gdb/doc: Document the exit command Enze Li
@ 2021-11-13 13:39     ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2021-11-13 13:39 UTC (permalink / raw)
  To: Enze Li; +Cc: gdb-patches

> Date: Sat, 13 Nov 2021 20:08:55 +0800
> From: Enze Li via Gdb-patches <gdb-patches@sourceware.org>
> 
> Update "Quitting GDB" section.
> 
> 	* gdb/doc/gdb.texinfo: (Quitting GDB): Document "exit".

I think I already approved this, didn't I?

Thanks.

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

* [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-11-13 12:08   ` [PATCH 1/2] gdb: improve quit command with an alias called exit Enze Li
@ 2021-11-23 14:21     ` Enze Li
  2021-11-27  7:02       ` any issue with adding new command (alias) "exit"? " Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Enze Li @ 2021-11-23 14:21 UTC (permalink / raw)
  To: gdb-patches

PING*1

Thanks,
Enze

On Sat, 2021-11-13 at 20:08 +0800, Enze Li via Gdb-patches wrote:
> This commit implements a request to add a quit command alias in
> PR28406[1]. With this commit, we can now use the "exit" alias
> to exit the GDB.
> 
> Tested on x86_64-linux.
> 
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28406
> ---
>  gdb/cli/cli-cmds.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index 2cf614c8e7e..832c9e56937 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -2377,7 +2377,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
> @@ -2385,6 +2385,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,
> _("\


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

* any issue with adding new command (alias) "exit"? Re: [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-11-23 14:21     ` [PING] " Enze Li
@ 2021-11-27  7:02       ` Joel Brobecker
  2021-11-27 20:40         ` Tom de Vries
  0 siblings, 1 reply; 12+ messages in thread
From: Joel Brobecker @ 2021-11-27  7:02 UTC (permalink / raw)
  To: Enze Li via Gdb-patches; +Cc: Joel Brobecker

Does anyone see an issue with adding the "exit" alias command
as suggested by the PR & patch below?


On Tue, Nov 23, 2021 at 10:21:13PM +0800, Enze Li via Gdb-patches wrote:
> PING*1
> 
> Thanks,
> Enze
> 
> On Sat, 2021-11-13 at 20:08 +0800, Enze Li via Gdb-patches wrote:
> > This commit implements a request to add a quit command alias in
> > PR28406[1]. With this commit, we can now use the "exit" alias
> > to exit the GDB.
> > 
> > Tested on x86_64-linux.
> > 
> > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28406
> > ---
> >  gdb/cli/cli-cmds.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> > index 2cf614c8e7e..832c9e56937 100644
> > --- a/gdb/cli/cli-cmds.c
> > +++ b/gdb/cli/cli-cmds.c
> > @@ -2377,7 +2377,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
> > @@ -2385,6 +2385,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,
> > _("\
> 

-- 
Joel

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

* Re: any issue with adding new command (alias) "exit"? Re: [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-11-27  7:02       ` any issue with adding new command (alias) "exit"? " Joel Brobecker
@ 2021-11-27 20:40         ` Tom de Vries
  2021-12-04 11:26           ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Tom de Vries @ 2021-11-27 20:40 UTC (permalink / raw)
  To: Joel Brobecker, Enze Li via Gdb-patches

On 11/27/21 8:02 AM, Joel Brobecker via Gdb-patches wrote:
> Does anyone see an issue with adding the "exit" alias command
> as suggested by the PR & patch below?
> 
> 

When I'm in a shell I don't know very well, and I want to exit, I try
quit, exit, ^C, ^D hoping to get the right command.

So, the exit alias for quit makes sense to me.

Thanks,
- Tom

> On Tue, Nov 23, 2021 at 10:21:13PM +0800, Enze Li via Gdb-patches wrote:
>> PING*1
>>
>> Thanks,
>> Enze
>>
>> On Sat, 2021-11-13 at 20:08 +0800, Enze Li via Gdb-patches wrote:
>>> This commit implements a request to add a quit command alias in
>>> PR28406[1]. With this commit, we can now use the "exit" alias
>>> to exit the GDB.
>>>
>>> Tested on x86_64-linux.
>>>
>>> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28406
>>> ---
>>>  gdb/cli/cli-cmds.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
>>> index 2cf614c8e7e..832c9e56937 100644
>>> --- a/gdb/cli/cli-cmds.c
>>> +++ b/gdb/cli/cli-cmds.c
>>> @@ -2377,7 +2377,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
>>> @@ -2385,6 +2385,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,
>>> _("\
>>
> 

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

* Re: any issue with adding new command (alias) "exit"? Re: [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-11-27 20:40         ` Tom de Vries
@ 2021-12-04 11:26           ` Joel Brobecker
  2021-12-11 10:50             ` Enze Li
  0 siblings, 1 reply; 12+ messages in thread
From: Joel Brobecker @ 2021-12-04 11:26 UTC (permalink / raw)
  To: Enze Li via Gdb-patches; +Cc: Joel Brobecker

> On 11/27/21 8:02 AM, Joel Brobecker via Gdb-patches wrote:
> > Does anyone see an issue with adding the "exit" alias command
> > as suggested by the PR & patch below?
> > 
> > 
> 
> When I'm in a shell I don't know very well, and I want to exit, I try
> quit, exit, ^C, ^D hoping to get the right command.
> 
> So, the exit alias for quit makes sense to me.

Thanks for the feedback Tom.

Enze,

I just realized this patch needs a NEWS entry. Can you post an updated
version so the NEWS entry can be reviewed as well (normally by EliZ).

Thanks!

> > On Tue, Nov 23, 2021 at 10:21:13PM +0800, Enze Li via Gdb-patches wrote:
> >> PING*1
> >>
> >> Thanks,
> >> Enze
> >>
> >> On Sat, 2021-11-13 at 20:08 +0800, Enze Li via Gdb-patches wrote:
> >>> This commit implements a request to add a quit command alias in
> >>> PR28406[1]. With this commit, we can now use the "exit" alias
> >>> to exit the GDB.
> >>>
> >>> Tested on x86_64-linux.
> >>>
> >>> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28406
> >>> ---
> >>>  gdb/cli/cli-cmds.c | 3 ++-
> >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> >>> index 2cf614c8e7e..832c9e56937 100644
> >>> --- a/gdb/cli/cli-cmds.c
> >>> +++ b/gdb/cli/cli-cmds.c
> >>> @@ -2377,7 +2377,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
> >>> @@ -2385,6 +2385,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,
> >>> _("\
> >>
> > 

-- 
Joel

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

* Re: any issue with adding new command (alias) "exit"? Re: [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-12-04 11:26           ` Joel Brobecker
@ 2021-12-11 10:50             ` Enze Li
  2021-12-18 11:23               ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Enze Li @ 2021-12-11 10:50 UTC (permalink / raw)
  To: Joel Brobecker, Enze Li via Gdb-patches

Hi Joel,

The latest version is here.
https://sourceware.org/pipermail/gdb-patches/2021-December/184223.html

After you approve it, could you please help me to push it if you don't
mind?

Thanks,
Enze

On Sat, 2021-12-04 at 15:26 +0400, Joel Brobecker via Gdb-patches
wrote:
> > On 11/27/21 8:02 AM, Joel Brobecker via Gdb-patches wrote:
> > > Does anyone see an issue with adding the "exit" alias command
> > > as suggested by the PR & patch below?
> > > 
> > > 
> > 
> > When I'm in a shell I don't know very well, and I want to exit, I try
> > quit, exit, ^C, ^D hoping to get the right command.
> > 
> > So, the exit alias for quit makes sense to me.
> 
> Thanks for the feedback Tom.
> 
> Enze,
> 
> I just realized this patch needs a NEWS entry. Can you post an updated
> version so the NEWS entry can be reviewed as well (normally by EliZ).
> 
> Thanks!
> 
> > 


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

* Re: any issue with adding new command (alias) "exit"? Re: [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-12-11 10:50             ` Enze Li
@ 2021-12-18 11:23               ` Joel Brobecker
  2021-12-18 13:26                 ` Enze Li
  0 siblings, 1 reply; 12+ messages in thread
From: Joel Brobecker @ 2021-12-18 11:23 UTC (permalink / raw)
  To: Enze Li; +Cc: Joel Brobecker, Enze Li via Gdb-patches

> The latest version is here.
> https://sourceware.org/pipermail/gdb-patches/2021-December/184223.html
> 
> After you approve it, could you please help me to push it if you don't
> mind?

Sure, done.
https://sourceware.org/pipermail/gdb-cvs/2021-December/052053.html

I could see in the FSF records that you have assigned past and
future changes for GDB, so given that you now have submitted at
least one good patch, you are eligible for receiving Write After
Approval access to the repository. Let us know if you'd like
instructions on how to do that.

-- 
Joel

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

* Re: any issue with adding new command (alias) "exit"? Re: [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-12-18 11:23               ` Joel Brobecker
@ 2021-12-18 13:26                 ` Enze Li
  2021-12-19  3:41                   ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Enze Li @ 2021-12-18 13:26 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Enze Li via Gdb-patches

On Sat, 2021-12-18 at 15:23 +0400, Joel Brobecker wrote:
> 
> I could see in the FSF records that you have assigned past and
> future changes for GDB, so given that you now have submitted at
> least one good patch, you are eligible for receiving Write After
> Approval access to the repository. Let us know if you'd like
> instructions on how to do that.
> 

It's my honor to have the access, yes!

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

* Re: any issue with adding new command (alias) "exit"? Re: [PING] [PATCH 1/2] gdb: improve quit command with an alias called exit
  2021-12-18 13:26                 ` Enze Li
@ 2021-12-19  3:41                   ` Joel Brobecker
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Brobecker @ 2021-12-19  3:41 UTC (permalink / raw)
  To: Enze Li; +Cc: Joel Brobecker, Enze Li via Gdb-patches

> > I could see in the FSF records that you have assigned past and
> > future changes for GDB, so given that you now have submitted at
> > least one good patch, you are eligible for receiving Write After
> > Approval access to the repository. Let us know if you'd like
> > instructions on how to do that.
> > 
> 
> It's my honor to have the access, yes!

I will send instructions off-line.

-- 
Joel

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

end of thread, other threads:[~2021-12-19  3:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211113120413.21486-2-lienze2010@hotmail.com>
2021-11-13 12:08 ` [PATCH 0/2][PR 28406] gdb: add exit command as an alias for quit Enze Li
     [not found] ` <20211113120855.21949-1-lienze2010@hotmail.com>
2021-11-13 12:08   ` [PATCH 1/2] gdb: improve quit command with an alias called exit Enze Li
2021-11-23 14:21     ` [PING] " Enze Li
2021-11-27  7:02       ` any issue with adding new command (alias) "exit"? " Joel Brobecker
2021-11-27 20:40         ` Tom de Vries
2021-12-04 11:26           ` Joel Brobecker
2021-12-11 10:50             ` Enze Li
2021-12-18 11:23               ` Joel Brobecker
2021-12-18 13:26                 ` Enze Li
2021-12-19  3:41                   ` Joel Brobecker
2021-11-13 12:08   ` [PATCH 2/2] gdb/doc: Document the exit command Enze Li
2021-11-13 13:39     ` Eli Zaretskii

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