[PATCH] libgcc: Fix _Unwind_Backtrace() for SEH

Seija K. doremylover123@gmail.com
Thu Jun 3 16:42:07 GMT 2021


Forgot to assign to gcc_context.cfa and gcc_context.ra. Note this fix can
be backported to earlier editions of gcc as well

diff --git a/libgcc/unwind-seh.c b/libgcc/unwind-seh.c
index 8c6aade9a3b39..d40d16702a9e1 100644
--- a/libgcc/unwind-seh.c
+++ b/libgcc/unwind-seh.c
@@ -466,6 +466,9 @@ _Unwind_Backtrace(_Unwind_Trace_Fn trace,
 			    &gcc_context.disp->HandlerData,
 			    &gcc_context.disp->EstablisherFrame, NULL);

+      gcc_context.cfa = ms_context.Rsp;
+      gcc_context.ra = ms_context.Rip;
+
       /* Call trace function.  */
       if (trace (&gcc_context, trace_argument) != _URC_NO_REASON)
 	return _URC_FATAL_PHASE1_ERROR;


More information about the Gcc-patches mailing list