public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Jon TURNEY <jon.turney@dronecode.org.uk>
To: cygwin-patches@cygwin.com
Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Subject: [PATCH 3/3] Set mcontext.cr2 to the faulting address
Date: Thu, 09 Apr 2015 13:13:00 -0000	[thread overview]
Message-ID: <1428585205-14420-4-git-send-email-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <1428585205-14420-1-git-send-email-jon.turney@dronecode.org.uk>

	* exceptions.cc (call_signal_handler): Set mcontext.cr2 to the
	faulting address.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 winsup/cygwin/ChangeLog     | 5 +++++
 winsup/cygwin/exceptions.cc | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 0223052..919122e 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;
         }
 
-- 
2.1.4

  reply	other threads:[~2015-04-09 13:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 13:13 [PATCH 0/3] signal handler ucontext improvements Jon TURNEY
2015-04-09 13:13 ` Jon TURNEY [this message]
2015-04-09 14:54   ` [PATCH 3/3] Set mcontext.cr2 to the faulting address Corinna Vinschen
2015-04-09 13:13 ` [PATCH 2/3] Only construct ucontext for SA_SIGINFO signal handlers Jon TURNEY
2015-04-09 13:13 ` [PATCH 1/3] Initialize context before RtlContextCapture Jon TURNEY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428585205-14420-4-git-send-email-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).