Re: [PATCH v2 7/9] gdb: Provide gdbarch hook to distinguish shadow stack backtrace elements.

Tom Tromey
2026-02-19T17:42:50Z

>>>>> Christina Schimpe <christina.schimpe@intel.com> writes:

> On x86 with CET or on ARM with GCS, there can be elements on the shadow
> stack which are not return addresses. In this case, we don't want to print
> the shadow stack element, but a string instead which describes the frame
> similar to the normal backtrace command for dummy frames or signals.

> Provide a gdbarch hook to distinguish between return and non-return
> addresses and to configure a string which is printed instead of the
> shadow stack element.

This seems reasonable enough to me.

Could you double-check that everything is consistent by re-running
check-gdbarch.py on your tree? If that is silent then it's fine.

> +Return true, if FRAME does not contain a return address in FRAME->VALUE
> +but another valid value for the architecture's shadow stack. In this case,
> +also the string frame_type has to be configured to display the type in the
> +shadow stack backtrace.

I wonder if you considered returning a std::optional<std::string> here
instead, just to be sure that the return value and the required
auxiliary data could not possibly be out of sync.

Anyway,
Approved-By: Tom Tromey <tom@tromey.com>

Tom