Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Lancelot SIX <lsix@lancelotsix.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v4] inferior without argument prints detail of current inferior
Date: Sun, 10 Jan 2021 20:14:22 -0500	[thread overview]
Message-ID: <83d1ebfc-63fe-c20a-e892-2f40b041ed2e@polymtl.ca> (raw)
In-Reply-To: <20210110175824.16110-1-lsix@lancelotsix.com>

On 2021-01-10 12:58 p.m., Lancelot SIX via Gdb-patches wrote:
> This patch makes the inferior command display information about the
> current inferior when called with no argument. This behavior is similar
> to the one of the thread command.
> 
> This contribution is inspired by an item in
> https://sourceware.org/gdb/wiki/ProjectIdeas
> 
> Before patch:
> 
>     (gdb) info inferior
>       Num  Description       Connection           Executable
>     * 1    process 19221     1 (native)           /home/lsix/tmp/a.out
>       2    process 19239     1 (native)           /home/lsix/tmp/a.out
>     (gdb) inferior 2
>     [Switching to inferior 2 [process 19239] (/home/lsix/tmp/a.out)]
>     [Switching to thread 2.1 (process 19239)]
>     #0  0x0000000000401146 in main ()
>     (gdb) inferior
>     Argument required (expression to compute).
> 
> After patch:
> 
>     (gdb) info inferior
>       Num  Description       Connection           Executable
>     * 1    process 18699     1 (native)           /home/lsix/tmp/a.out
>       2    process 18705     1 (native)           /home/lsix/tmp/a.out
>     (gdb) inferior 2
>     [Switching to inferior 2 [process 18705] (/home/lsix/tmp/a.out)]
>     [Switching to thread 2.1 (process 18705)]
>     #0  0x0000000000401146 in main ()
>     (gdb) inferior
>     [Current inferior is 2 [process 18705] (/home/lsix/tmp/a.out)]
> 
> Changes from V1:
> 	* Add test.
> 
> Change from V2:
> 	* Fix gdb/doc/ChangeLog entry.
> 
> Change from V3:
> 	* Add entry in the NEWS file.
> 	* Improve inferior-noarg.expr and remove assumptions particular
> 	format in pid_to_str.
> 	* Fix copyright year in new files.
> 
> gdb/doc/ChangeLog:
> 
> 	* gdb.texinfo (Inferiors Connections and Programs): Document the
> 	inferior command when used without argument.
> 
> gdb/ChangeLog:
> 
>   * NEWS: Add entry for the behavior change of the inferior command.
> 	* inferior.c (inferior_command): When no argument is given to the
> 	inferior command, display info about the currently selected
> 	inferior.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* gdb.base/inferior-noarg.c: New test.
> 	* gdb.base/inferior-noarg.exp: New test.
> 
> ---
> ---
>  gdb/NEWS                                  |  6 +++
>  gdb/doc/gdb.texinfo                       | 16 +++++++
>  gdb/inferior.c                            | 58 +++++++++++++++--------
>  gdb/testsuite/gdb.base/inferior-noarg.c   | 22 +++++++++
>  gdb/testsuite/gdb.base/inferior-noarg.exp | 36 ++++++++++++++
>  5 files changed, 117 insertions(+), 21 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.base/inferior-noarg.c
>  create mode 100644 gdb/testsuite/gdb.base/inferior-noarg.exp
> 
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 66702862ef..d9788f6733 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -75,6 +75,12 @@ maintenance flush-symbol-cache
>    'maintenance flush register-cache' and 'maintenance flush
>    symbol-cache' respectively.
>  
> +inferior [ID]
> +  When the ID parameter is omitted, then this command prints information
> +  about the current inferior.  When the ID parameter is present, the
> +  behavior of the command is unchanged and have the inferior ID become
> +  the current inferior.

I'll let Eli review the NEWS entry, otherwise the patch LGTM.  Let us know
when you have your sourceware account.

Simon

  reply	other threads:[~2021-01-11  1:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 22:04 [PATCH v2] " Lancelot SIX via Gdb-patches
2020-12-18 22:24 ` Simon Marchi via Gdb-patches
2021-01-09 21:24   ` [PATCH v3] " Lancelot SIX via Gdb-patches
2021-01-10 16:00     ` Simon Marchi via Gdb-patches
2021-01-10 17:37       ` Lancelot SIX via Gdb-patches
2021-01-11  1:06         ` Simon Marchi via Gdb-patches
2021-01-10 16:41     ` Eli Zaretskii via Gdb-patches
2021-01-10 17:38       ` Lancelot SIX via Gdb-patches
2021-01-10 17:58 ` [PATCH v4] " Lancelot SIX via Gdb-patches
2021-01-11  1:14   ` Simon Marchi via Gdb-patches [this message]
2021-01-11 14:57     ` Eli Zaretskii via Gdb-patches
2021-02-02 22:44   ` Lancelot SIX via Gdb-patches
2021-02-02 22:59     ` Simon Marchi via Gdb-patches
2021-02-02 23:04       ` Lancelot SIX via Gdb-patches
2021-02-02 23:37         ` Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83d1ebfc-63fe-c20a-e892-2f40b041ed2e@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox