Re: [PATCH v2 9/9] gdb, mi: Add -shadow-stack-list-frames command

Eli Zaretskii
2026-01-23T08:46:38Z

> From: Christina Schimpe <christina.schimpe@intel.com>
> Cc: thiago.bauermann@linaro.org
> Date: Fri, 23 Jan 2026 08:05:31 +0000
>
> gdb/NEWS | 10 ++
> gdb/doc/gdb.texinfo | 47 ++++++
> gdb/mi/mi-cmd-stack.c | 142 ++++++++++++++++++
> gdb/mi/mi-cmds.c | 2 +
> gdb/mi/mi-cmds.h | 1 +
> gdb/shadow-stack.c | 18 ++-
> gdb/shadow-stack.h | 11 ++
> .../gdb.mi/mi-shadow-stack-signal.exp | 69 +++++++++
> gdb/testsuite/gdb.mi/mi-shadow-stack.exp | 65 ++++++++
> 9 files changed, 362 insertions(+), 3 deletions(-)
> create mode 100644 gdb/testsuite/gdb.mi/mi-shadow-stack-signal.exp
> create mode 100644 gdb/testsuite/gdb.mi/mi-shadow-stack.exp

Thanks.

> diff --git a/gdb/NEWS b/gdb/NEWS
> index 37b3add11ed..d3991a495f4 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -177,6 +177,16 @@ qExecAndArgs
> deprecated since GDB 10. Users who need to control the size of a
> memory port's internal buffer can use the 'setvbuf' procedure.
>
> +* New MI commands
> +
> +-shadow-stack-list-frames
> +
> + Added new MI command '-shadow-stack-list-frames' which is equivalent to
> + the CLI subcommand 'backtrace shadow' but supports 'low-frame' and
> + 'high-frame' as command line parameters. The parameters are used to
> + print shadow stack frames between certain levels on the shadow stack
> + only.
> +

This part is okay.

> +List the shadow stack frames currently on the shadow stack. In case the
> +element on the shadow stack is a return address, @value{GDBN} prints the
> +same fields as in -stack-list-frames with the return address on the shadow
^^^^^^^^^^^^^^^^^^
This should be in @code.

> +If invoked without arguments, this command prints a backtrace for the
> +whole shadow stack. Like the -stack-list-frames command, if given two
^^^^^^^^^^^^^^^^^^
Likewise.

> +For frame 1 we can see that we only print @var{level}, @var{addr} and
> +@var{arch}.

Using "we" in the manual is not the best way of expressing such stuff.
How about

Note that for frame 1 @value{GDBN} printed only @var{level},
@var{addr}, and @var{arch}.

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