[PATCH v2] [gdb/mi] Don't treat references to compound values as "simple".
Eli Zaretskii
eliz@gnu.org
Thu Sep 8 13:30:06 GMT 2022
> Date: Thu, 8 Sep 2022 12:02:48 +0100
> From: Gareth Rees via Gdb-patches <gdb-patches@sourceware.org>
>
> There are two ways we could fix this problem, depending on whether we
> consider the current behaviour to be a bug.
>
> 1. If the current behaviour is a bug, then we can update the behaviour
> of '--simple-values' so that it takes reference types into account:
> that is, a value is simple if it is neither an array, struct, or
> union, nor a reference to an array, struct or union.
>
> In this case we must add a feature to the '-list-features' command so
> that IDEs can detect that it is safe to use the '--simple-values'
> argument when refreshing the call stack.
>
> 2. If the current behaviour is not a bug, then we can add a new option
> for the PRINT-VALUES argument, for example, '--simplest-values' (3),
> that would be suitable for use by IDEs.
>
> In this case we must add a feature to the '-list-features' command so
> that IDEs can detect that the '--simplest-values' argument is
> available for use when refreshing the call stack.
>
> PATCH
>
> This patch implements solution (1) as I think the current behaviour of
> not printing structures, but printing references to structures, is
> contrary to reasonable expectation.
Thanks. FWIW, I think we should implement 2, not 1.
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -114,6 +114,18 @@ maintenance info line-table
> entry corresponds to an address where a breakpoint should be placed
> to be at the first instruction past a function's prologue.
>
> +* MI changes
> +
> + ** The '--simple-values' argument to the '-stack-list-arguments',
> + '-stack-list-locals', '-stack-list-variables', and
> + '-var-list-children' commands takes reference types into account:
> + that is, a value is now considered simple if it is neither an
> + array, structure, or union, nor a reference to an array, structure,
> + or union.
Isn't it easier to say "only if the value is a scalar"?
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 238a49b027d..5ccf6609709 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -37295,6 +37295,13 @@ option (@pxref{GDB/MI Program Execution}).
> @item data-disassemble-a-option
> Indicates that the @code{-data-disassemble} command supports the @option{-a}
> option (@pxref{GDB/MI Data Manipulation}).
> +@item simple-values-ref-types
> +Indicates that the @code{--simple-values} argument to the
> +@code{-stack-list-arguments}, @code{-stack-list-locals},
> +@code{-stack-list-variables}, and @code{-var-list-children} commands
> +takes reference types into account: that is, a value is considered
> +simple if it neither an array, structure, or union, nor a reference to
> +an array, structure, or union.
> @end ftable
Same here.
Other than that, the documentation parts are OK.
More information about the Gdb-patches
mailing list