[PATCH v2 2/4] gdb/cli: Improve UX when using list with no args

Eli Zaretskii eliz@gnu.org
Tue Jun 20 16:19:28 GMT 2023


> From: Bruno Larsen <blarsen@redhat.com>
> Cc: eliz@gnu.org,
> 	Bruno Larsen <blarsen@redhat.com>
> Date: Tue, 20 Jun 2023 17:52:58 +0200
> 
>  gdb/NEWS                        |  7 +++++++
>  gdb/cli/cli-cmds.c              | 36 +++++++++++++++++++++++++++++++--
>  gdb/doc/gdb.texinfo             |  7 +++++--
>  gdb/source.c                    | 18 +++++++++++++++++
>  gdb/source.h                    |  4 ++++
>  gdb/testsuite/gdb.base/list.exp |  8 ++++----
>  6 files changed, 72 insertions(+), 8 deletions(-)

Thanks.

> +* Using the 'list' command with no arguments in a situation where the
> +  command would attempt to list past the end of the file, instead of
> +  erroring out, it will now warn the user that the end of file has been
> +  reached and the default location will be printed.  The default location
> +  is either the last solitary line printed (if there was one) or around
> +  the main function.

The first sentence is too complex.  I suggest to rephrase:

  Using the 'list' command with no arguments in a situation where the
  command would attempt to list past the end of the file now warns the
  user that the end of file has been reached, and prints the default
  location.  Previously, it would error out.  The default location for
  this purpose is the last solitary line printed, if there was one,
  else the lines around the main function.

> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -9142,9 +9142,12 @@ Print lines centered around the beginning of function
>  @item list
>  Print more lines.  If the last lines printed were printed with a
>  @code{list} command, this prints lines following the last lines
> -printed; however, if the last line printed was a solitary line printed
> +printed; however, if those lines are past the end of the source
> +file, or if the last line printed was a solitary line printed
>  as part of displaying a stack frame (@pxref{Stack, ,Examining the
> -Stack}), this prints lines centered around that line.
> +Stack}), this prints lines centered around that line. If no
                                                       ^^
Two spaces there, please.

> +@code{list} command has been used and no solitary line was printed,
> +it prints the lines around the function @code{main}.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>


More information about the Gdb-patches mailing list