diff mbox series

libgcc: Fix _Unwind_Backtrace() for SEH

Message ID CAA42iKz6bGZZQw2YzwA7eYdU545kToQgiOJ_7PRcxp-aYH1AJg@mail.gmail.com
State New
Headers show
Series libgcc: Fix _Unwind_Backtrace() for SEH | expand

Commit Message

Seija K. June 3, 2021, 4:42 p.m. UTC
Forgot to assign to gcc_context.cfa and gcc_context.ra. Note this fix can
be backported to earlier editions of gcc as well

Comments

Eric Botcazou June 4, 2021, 10:45 a.m. UTC | #1
> Forgot to assign to gcc_context.cfa and gcc_context.ra. Note this fix can
> be backported to earlier editions of gcc as well

It's already done by:

2020-11-03  Martin Storsjö  <martin@martin.st>

	* unwind-seh.c (_Unwind_Backtrace): Set the ra and cfa pointers
	before calling the callback.

https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553418.html
diff mbox series

Patch

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;