This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin/cygwin-2.0] Set mcontext.cr2 to the faulting address
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 23 Apr 2015 20:52:14 -0000
- Subject: [newlib-cygwin/cygwin-2.0] Set mcontext.cr2 to the faulting address
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=bccc0e83e82af2e74e4a813bf551cad0b2305814
commit bccc0e83e82af2e74e4a813bf551cad0b2305814
Author: Jon TURNEY <jon.turney@dronecode.org.uk>
Date: Sat Apr 4 16:12:27 2015 +0100
Set mcontext.cr2 to the faulting address
* exceptions.cc (call_signal_handler): Set mcontext.cr2 to the
faulting address.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Diff:
---
winsup/cygwin/ChangeLog | 5 +++++
winsup/cygwin/exceptions.cc | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a3a0026..1b3003a 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): Set mcontext.cr2 to the
+ faulting address.
+
2015-04-02 Jon TURNEY <jon.turney@dronecode.org.uk>
* exceptions.cc (call_signal_handler): Only bother to construct
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 0c9ee14..4a6c21e 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1521,6 +1521,10 @@ _cygtls::call_signal_handler ()
context.uc_sigmask = context.uc_mcontext.oldmask = this_oldmask;
+ context.uc_mcontext.cr2 = (thissi.si_signo == SIGSEGV
+ || thissi.si_signo == SIGBUS)
+ ? (uintptr_t) thissi.si_addr : 0;
+
thiscontext = &context;
}