From d6385aa66e26e86832e1e95222e8026146bb63df Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 23 Apr 2015 14:45:05 +0100 Subject: [PATCH] Use the same continuation context in a signal as we would send to the debugger --- winsup/cygwin/exceptions.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 4a6c21e..c97cc19 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1503,12 +1503,7 @@ _cygtls::call_signal_handler () if (thissi.si_cyg) memcpy (&context.uc_mcontext, ((cygwin_exception *)thissi.si_cyg)->context(), sizeof(CONTEXT)); else - { - /* FIXME: Really this should be the context which the signal interrupted? */ - memset(&context.uc_mcontext, 0, sizeof(struct __mcontext)); - context.uc_mcontext.ctxflags = CONTEXT_FULL; - RtlCaptureContext ((CONTEXT *)&context.uc_mcontext); - } + memcpy (&context.uc_mcontext, &thread_context, sizeof(CONTEXT)); /* FIXME: If/when sigaltstack is implemented, this will need to do something more complicated */ @@ -1549,9 +1544,10 @@ void _cygtls::signal_debugger (siginfo_t& si) { HANDLE th; - /* If si.si_cyg is set then the signal was already sent to the debugger. */ + /* If si.si_cyg is set then the signal was caused by an exception which has + already been sent to the debugger. */ if (isinitialized () && !si.si_cyg && (th = (HANDLE) *this) - && being_debugged () && SuspendThread (th) >= 0) + && SuspendThread (th) >= 0) { CONTEXT c; c.ContextFlags = CONTEXT_FULL; -- 2.1.4