This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] Initialize context before RtlContextCapture
- From: Jon TURNEY <jturney at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 10 Apr 2015 14:42:42 -0000
- Subject: [newlib-cygwin] Initialize context before RtlContextCapture
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a5efc75cc195d2fa801b34461978440355dd9631
commit a5efc75cc195d2fa801b34461978440355dd9631
Author: Jon TURNEY <jon.turney@dronecode.org.uk>
Date: Sat Apr 4 16:19:31 2015 +0100
Initialize context before RtlContextCapture
* exceptions.cc (call_signal_handler): Zero initialize context and set
context flags, as RlCaptureContext doesn't.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Diff:
---
winsup/cygwin/ChangeLog | 5 +++++
winsup/cygwin/exceptions.cc | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e53ff94..6a8b8f5 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-04 Jon TURNEY <jon.turney@dronecode.org.uk>
+
+ * exceptions.cc (call_signal_handler): Zero initialize context and set
+ context flags, as RlCaptureContext doesn't.
+
2015-04-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open_with_arch): Call open with mode
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 0d1f36d..fe543ae 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1496,8 +1496,12 @@ _cygtls::call_signal_handler ()
if (thissi.si_cyg)
memcpy (&thiscontext.uc_mcontext, ((cygwin_exception *)thissi.si_cyg)->context(), sizeof(CONTEXT));
else
- RtlCaptureContext ((CONTEXT *)&thiscontext.uc_mcontext);
- /* FIXME: Really this should be the context which the signal interrupted? */
+ {
+ /* FIXME: Really this should be the context which the signal interrupted? */
+ memset(&thiscontext.uc_mcontext, 0, sizeof(struct __mcontext));
+ thiscontext.uc_mcontext.ctxflags = CONTEXT_FULL;
+ RtlCaptureContext ((CONTEXT *)&thiscontext.uc_mcontext);
+ }
/* FIXME: If/when sigaltstack is implemented, this will need to do
something more complicated */