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

Schimpe, Christina
2026-02-13T19:18:26Z

> -----Original Message-----
> From: Eli Zaretskii <eliz@gnu.org>
> Sent: Freitag, 23. Januar 2026 09:46
> To: Schimpe, Christina <christina.schimpe@intel.com>
> Cc: gdb-patches@sourceware.org; thiago.bauermann@linaro.org
> Subject: Re: [PATCH v2 9/9] gdb, mi: Add -shadow-stack-list-frames command
>
> > 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.

Yes, will fix!

> > +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}.

Oups, I was too quick when writing the docs here.
I further noticed that I missed to update the docs for v2 in this patch since the output for
signals changed also for the mi command.
Based on the results of our discussion with Thiago it might change even further since it's
planned to print "<signal handler called>" just like the normal bt command:
https://sourceware.org/pipermail/gdb-patches/2026-January/224054.html.
But the discussion is not complete yet.

In any case your suggestion sounds very good to me, I'll use that one and adapt it due to
the reasons described above for v3.

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

Thank you for the review.

Christina
Intel Deutschland GmbH
Registered Address: Dornacher Straße 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht München HRB 186928