Previously, the SEH version of _Unwind_Backtrace did unwind
the stack and call the provided callback function as intended,
but there was little the caller could do within the callback to
actually get any info about that particular level in the unwind.
Set the ra and cfa pointers, which are used by _Unwind_GetIP
and _Unwind_GetCFA, to allow using these functions from the
callacb to inspect the state at each stack frame.
2020-09-08 Martin Storsjö <martin@martin.st>
libgcc/
* unwind-seh.c (_Unwind_Backtrace): Set the ra and cfa pointers
before calling the callback.
&gcc_context.disp->HandlerData,
&gcc_context.disp->EstablisherFrame, NULL);
+ /* Set values that the callback can inspect via _Unwind_GetIP
+ * and _Unwind_GetCFA. */
+ gcc_context.ra = ms_context.Rip;
+ gcc_context.cfa = ms_context.Rsp;
+
/* Call trace function. */
if (trace (&gcc_context, trace_argument) != _URC_NO_REASON)
return _URC_FATAL_PHASE1_ERROR;