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] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD *
Date: Tue, 31 Mar 2015 17:47:00 -0000	[thread overview]
Message-ID: <1427824014-19504-4-git-send-email-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <1427824014-19504-1-git-send-email-jon.turney@dronecode.org.uk>

	* external.cc (cygwin_internal): Add operation to convert
	siginfo_t * to EXCEPTION_RECORD *.
	* include/sys/cygwin.h (cygwin_getinfo_types): Ditto.
	* exception.h (cygwin_exception): Add exception_record accessor.
---
 winsup/cygwin/ChangeLog            |  7 +++++++
 winsup/cygwin/exception.h          |  1 +
 winsup/cygwin/external.cc          | 13 +++++++++++++
 winsup/cygwin/include/sys/cygwin.h |  4 +++-
 4 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index f037112..2a94702 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
 2015-03-30  Jon TURNEY  <jon.turney@dronecode.org.uk>
 
+	* external.cc (cygwin_internal): Add operation to convert
+	siginfo_t * to EXCEPTION_RECORD *.
+	* include/sys/cygwin.h (cygwin_getinfo_types): Ditto.
+	* exception.h (cygwin_exception): Add exception_record accessor.
+
+2015-03-30  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
 	* include/sys/ucontext.h : New header.
 	* include/ucontext.h : Ditto.
 	* exceptions.cc (call_signal_handler): Provide ucontext_t
diff --git a/winsup/cygwin/exception.h b/winsup/cygwin/exception.h
index 3686bb0..0478daf 100644
--- a/winsup/cygwin/exception.h
+++ b/winsup/cygwin/exception.h
@@ -175,4 +175,5 @@ public:
     framep (in_framep), ctx (in_ctx), e (in_e), h (NULL) {}
   void dumpstack ();
   PCONTEXT context () const {return ctx;}
+  EXCEPTION_RECORD *exception_record () const {return e;}
 };
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index 5fac4bb..3c6bab2 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -27,6 +27,7 @@ details. */
 #include "environ.h"
 #include "cygserver_setpwd.h"
 #include "pwdgrp.h"
+#include "exception.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <wchar.h>
@@ -688,6 +689,18 @@ cygwin_internal (cygwin_getinfo_types t, ...)
 	res = 0;
 	break;
 
+      case CW_EXCEPTION_RECORD_FROM_SIGINFO_T:
+	{
+	  siginfo_t *si = va_arg(arg, siginfo_t *);
+	  res = 0;
+	  if (si && si->si_cyg)
+	    {
+	      EXCEPTION_RECORD *er = ((cygwin_exception *)si->si_cyg)->exception_record();
+	      res = (uintptr_t)er;
+	    }
+	}
+	break;
+
       default:
 	set_errno (ENOSYS);
     }
diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
index edfcc56..13f9866 100644
--- a/winsup/cygwin/include/sys/cygwin.h
+++ b/winsup/cygwin/include/sys/cygwin.h
@@ -1,3 +1,4 @@
+
 /* sys/cygwin.h
 
    Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
@@ -153,7 +154,8 @@ typedef enum
     CW_CYGNAME_FROM_WINNAME,
     CW_FIXED_ATEXIT,
     CW_GETNSS_PWD_SRC,
-    CW_GETNSS_GRP_SRC
+    CW_GETNSS_GRP_SRC,
+    CW_EXCEPTION_RECORD_FROM_SIGINFO_T,
   } cygwin_getinfo_types;
 
 #define CW_LOCK_PINFO CW_LOCK_PINFO
-- 
2.1.4

  parent reply	other threads:[~2015-03-31 17:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 17:47 [PATCH 0/3] Make detailled exception information available to signal handlers Jon TURNEY
2015-03-31 17:47 ` [PATCH 2/3] Make mcontext and stack " Jon TURNEY
2015-03-31 18:46   ` Corinna Vinschen
2015-03-31 17:47 ` [PATCH 1/3] Rename struct ucontext to struct __mcontext Jon TURNEY
2015-03-31 18:37   ` Corinna Vinschen
2015-03-31 17:47 ` Jon TURNEY [this message]
2015-03-31 19:11   ` [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD * Corinna Vinschen
2015-03-31 19:02 ` [PATCH 0/3] Make detailled exception information available to signal handlers Corinna Vinschen

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=1427824014-19504-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).