https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d89cc269039817729020bb6092efccd5bf520cd4

commit d89cc269039817729020bb6092efccd5bf520cd4
Author: Jon TURNEY <jon.tur...@dronecode.org.uk>
Date:   Mon Mar 30 20:56:03 2015 +0100

    Add cygwin_internal() operation to retrieve the EXCEPTION_RECORD from a 
siginfo_t *
    
        * external.cc (cygwin_internal): Add operation to retrieve a copy
        of the EXCEPTION_RECORD from a siginfo_t *.
        * include/sys/cygwin.h (cygwin_getinfo_types): Ditto.
        * exception.h (cygwin_exception): Add exception_record accessor.
    
    Signed-off-by: Jon TURNEY <jon.tur...@dronecode.org.uk>

Diff:
---
 winsup/cygwin/ChangeLog            |  7 +++++++
 winsup/cygwin/exception.h          |  1 +
 winsup/cygwin/external.cc          | 14 ++++++++++++++
 winsup/cygwin/include/sys/cygwin.h |  5 ++++-
 4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3b86991..b858a9c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
 2015-04-01  Jon TURNEY  <jon.tur...@dronecode.org.uk>
 
+       * external.cc (cygwin_internal): Add operation to retrieve a copy
+       of the EXCEPTION_RECORD from a siginfo_t *.
+       * include/sys/cygwin.h (cygwin_getinfo_types): Ditto.
+       * exception.h (cygwin_exception): Add exception_record accessor.
+
+2015-04-01  Jon TURNEY  <jon.tur...@dronecode.org.uk>
+
        * include/cygwin/signal.h : Rename struct ucontext to struct
        __mcontext.  Fix layout differences from the Win32 API CONTEXT
        type.  Remove unused member _internal.  Rename member which
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..e379df1 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,19 @@ cygwin_internal (cygwin_getinfo_types t, ...)
        res = 0;
        break;
 
+      case CW_EXCEPTION_RECORD_FROM_SIGINFO_T:
+       {
+         siginfo_t *si = va_arg(arg, siginfo_t *);
+         EXCEPTION_RECORD *er = va_arg(arg, EXCEPTION_RECORD *);
+         if (si && si->si_cyg && er)
+           {
+             memcpy(er, ((cygwin_exception *)si->si_cyg)->exception_record(),
+                    sizeof(EXCEPTION_RECORD));
+             res = 0;
+           }
+       }
+       break;
+
       default:
        set_errno (ENOSYS);
     }
diff --git a/winsup/cygwin/include/sys/cygwin.h 
b/winsup/cygwin/include/sys/cygwin.h
index edfcc56..2ec6086 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
@@ -214,6 +216,7 @@ typedef enum
 #define CW_FIXED_ATEXIT CW_FIXED_ATEXIT
 #define CW_GETNSS_PWD_SRC CW_GETNSS_PWD_SRC
 #define CW_GETNSS_GRP_SRC CW_GETNSS_GRP_SRC
+#define CW_EXCEPTION_RECORD_FROM_SIGINFO_T CW_EXCEPTION_RECORD_FROM_SIGINFO_T
 
 /* Token type for CW_SET_EXTERNAL_TOKEN */
 enum

Reply via email to