public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/3] Make detailled exception information available to signal handlers
@ 2015-03-31 17:47 Jon TURNEY
  2015-03-31 17:47 ` [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD * Jon TURNEY
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jon TURNEY @ 2015-03-31 17:47 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon TURNEY

Thanks for your help so far.  Here's another attempt at this.

Questions:

The ContextFlags member of the CONTEXT type is named cr2 in struct __mcontext. I 
don't understand how that can be right.

For a non-exception signal, we won't have aCONTEXT to provide.  Is one that is 
all zeroes acceptable?

Jon TURNEY (3):
  Rename struct ucontext to struct __mcontext
  Make mcontext and stack information available to signal handlers
  Add cygwin_internal() operation to convert siginfo_t * to
    EXCEPTION_RECORD *

 winsup/cygwin/ChangeLog               | 20 ++++++++++++++++++++
 winsup/cygwin/exception.h             |  1 +
 winsup/cygwin/exceptions.cc           | 20 ++++++++++++++++++--
 winsup/cygwin/external.cc             | 13 +++++++++++++
 winsup/cygwin/include/cygwin/signal.h | 18 +++++++++++-------
 winsup/cygwin/include/sys/cygwin.h    |  4 +++-
 winsup/cygwin/include/sys/ucontext.h  | 26 ++++++++++++++++++++++++++
 winsup/cygwin/include/ucontext.h      | 16 ++++++++++++++++
 8 files changed, 108 insertions(+), 10 deletions(-)
 create mode 100644 winsup/cygwin/include/sys/ucontext.h
 create mode 100644 winsup/cygwin/include/ucontext.h

-- 
2.1.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] Make mcontext and stack information available to signal handlers
  2015-03-31 17:47 [PATCH 0/3] Make detailled exception information available to signal handlers Jon TURNEY
  2015-03-31 17:47 ` [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD * Jon TURNEY
@ 2015-03-31 17:47 ` 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 19:02 ` [PATCH 0/3] Make detailled exception information available to signal handlers Corinna Vinschen
  3 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2015-03-31 17:47 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon TURNEY

Add ucontext.h header, defining ucontext_t and mcontext_t types.

Provide sigaction sighandlers with a ucontext_t parameter, containing stack and
context information.

XXX: How do we indicate context information is not available (si_cyg == NULL)

	* include/sys/ucontext.h : New header.
	* include/ucontext.h : Ditto.
	* exceptions.cc (call_signal_handler): Provide ucontext_t
	parameter to signal handler function.
---
 winsup/cygwin/ChangeLog              |  7 +++++++
 winsup/cygwin/exceptions.cc          | 20 ++++++++++++++++++--
 winsup/cygwin/include/sys/ucontext.h | 26 ++++++++++++++++++++++++++
 winsup/cygwin/include/ucontext.h     | 16 ++++++++++++++++
 4 files changed, 67 insertions(+), 2 deletions(-)
 create mode 100644 winsup/cygwin/include/sys/ucontext.h
 create mode 100644 winsup/cygwin/include/ucontext.h

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1b4f4f3..f037112 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
 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
+	parameter to signal handler function.
+
+2015-03-30  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
 	* include/cygwin/signal.h : Rename struct ucontext to struct
 	__mcontext.  Remove unused member _internal.  Fix differences from
 	the Win32 API CONTEXT type.
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index af53457..1c15bae 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -16,6 +16,7 @@ details. */
 #include <stdlib.h>
 #include <syslog.h>
 #include <wchar.h>
+#include <ucontext.h>
 
 #include "cygtls.h"
 #include "pinfo.h"
@@ -1487,8 +1488,24 @@ _cygtls::call_signal_handler ()
       /* Save information locally on stack to pass to handler. */
       int thissig = sig;
       siginfo_t thissi = infodata;
+      ucontext_t *thiscontext = NULL;
       void (*thisfunc) (int, siginfo_t *, void *) = func;
 
+      ucontext_t context;
+      thiscontext = &context;
+      memset (&context, 0, sizeof(ucontext_t));
+      if (thissi.si_cyg)
+        {
+          memcpy (&context.uc_mcontext, ((cygwin_exception *)thissi.si_cyg)->context(), sizeof(CONTEXT));
+        }
+
+      context.uc_stack.ss_sp = NtCurrentTeb ()->Tib.StackBase;
+      context.uc_stack.ss_flags = 0;
+      if (!NtCurrentTeb ()->DeallocationStack)
+        context.uc_stack.ss_size = (uintptr_t)NtCurrentTeb ()->Tib.StackLimit - (uintptr_t)NtCurrentTeb ()->Tib.StackBase;
+      else
+        context.uc_stack.ss_size = (uintptr_t)NtCurrentTeb ()->DeallocationStack - (uintptr_t)NtCurrentTeb ()->Tib.StackBase;
+
       sigset_t this_oldmask = set_process_mask_delta ();
       int this_errno = saved_errno;
       reset_signal_arrived ();
@@ -1496,8 +1513,7 @@ _cygtls::call_signal_handler ()
       sig = 0;		/* Flag that we can accept another signal */
       unlock ();	/* unlock signal stack */
 
-      /* no ucontext_t information provided yet, so third arg is NULL */
-      thisfunc (thissig, &thissi, NULL);
+      thisfunc (thissig, &thissi, thiscontext);
       incyg = true;
 
       set_signal_mask (_my_tls.sigmask, this_oldmask);
diff --git a/winsup/cygwin/include/sys/ucontext.h b/winsup/cygwin/include/sys/ucontext.h
new file mode 100644
index 0000000..ef0e849
--- /dev/null
+++ b/winsup/cygwin/include/sys/ucontext.h
@@ -0,0 +1,26 @@
+/* ucontext.h
+
+   Copyright 2015 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _SYS_UCONTEXT_H_
+#define _SYS_UCONTEXT_H_
+
+#include <cygwin/signal.h>
+#include <sys/signal.h>
+
+typedef struct __mcontext mcontext_t;
+
+typedef struct __ucontext {
+	struct __ucontext *uc_link;
+	sigset_t	uc_sigmask;
+	stack_t	uc_stack;
+	mcontext_t	uc_mcontext;
+} ucontext_t;
+
+#endif /* !_SYS_UCONTEXT_H_ */
diff --git a/winsup/cygwin/include/ucontext.h b/winsup/cygwin/include/ucontext.h
new file mode 100644
index 0000000..4240597
--- /dev/null
+++ b/winsup/cygwin/include/ucontext.h
@@ -0,0 +1,16 @@
+/* ucontext.h
+
+   Copyright 2015 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _UCONTEXT_H
+#define _UCONTEXT_H
+
+#include <sys/ucontext.h>
+
+#endif /* _UCONTEXT_H */
-- 
2.1.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] Rename struct ucontext to struct __mcontext
  2015-03-31 17:47 [PATCH 0/3] Make detailled exception information available to signal handlers Jon TURNEY
  2015-03-31 17:47 ` [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD * Jon TURNEY
  2015-03-31 17:47 ` [PATCH 2/3] Make mcontext and stack information available to signal handlers Jon TURNEY
@ 2015-03-31 17:47 ` Jon TURNEY
  2015-03-31 18:37   ` Corinna Vinschen
  2015-03-31 19:02 ` [PATCH 0/3] Make detailled exception information available to signal handlers Corinna Vinschen
  3 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2015-03-31 17:47 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon TURNEY

	* include/cygwin/signal.h : Rename struct ucontext to struct
	__mcontext.  Remove unused member _internal.  Fix differences from
	the Win32 API CONTEXT type.

XXX: the ContextFlags member of the CONTEXT type is named cr2.  This looks
wrong.
---
 winsup/cygwin/ChangeLog               |  6 ++++++
 winsup/cygwin/include/cygwin/signal.h | 18 +++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 505f4ce..1b4f4f3 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-30  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
+	* include/cygwin/signal.h : Rename struct ucontext to struct
+	__mcontext.  Remove unused member _internal.  Fix differences from
+	the Win32 API CONTEXT type.
+
 2015-03-30  Corinna Vinschen  <corinna@vinschen.de>
 
 	* cygtls.h (struct _cygtls): Convert thread_context to type CONTEXT.
diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h
index 58bbff0..3fefdf7 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -18,6 +18,10 @@
 extern "C" {
 #endif
 
+/*
+  Define a struct __mcontext, which should be identical in layout to the Win32
+  API type CONTEXT with the addition of an oldmask field at the end.
+*/
 #ifdef __x86_64__
 
 struct _uc_fpxreg {
@@ -45,7 +49,7 @@ struct _fpstate
   __uint32_t padding[24];
 };
 
-struct ucontext
+struct __mcontext
 {
   __uint64_t p1home;
   __uint64_t p2home;
@@ -86,13 +90,13 @@ struct ucontext
   __uint64_t r15;
   __uint64_t rip;
   struct _fpstate fpregs;
+  __uint64_t vregs[52];
   __uint64_t vcx;
   __uint64_t dbc;
   __uint64_t btr;
   __uint64_t bfr;
   __uint64_t etr;
   __uint64_t efr;
-  __uint8_t _internal;
   __uint64_t oldmask;
 };
 
@@ -117,7 +121,7 @@ struct _fpstate
   __uint32_t nxst;
 };
 
-struct ucontext
+struct __mcontext
 {
   __uint32_t cr2;
   __uint32_t dr0;
@@ -143,15 +147,15 @@ struct ucontext
   __uint32_t eflags;
   __uint32_t esp;
   __uint32_t ss;
-  __uint8_t _internal;
+  __uint32_t reserved[128];
   __uint32_t oldmask;
 };
 
 #endif /* !x86_64 */
 
-/* Needed for GDB.   It only compiles in the context copy code if this
-   macro s defined. */
-#define __COPY_CONTEXT_SIZE ((size_t) (uintptr_t) &((struct ucontext *) 0)->_internal)
+/* Needed for GDB 7.9 and earlier.  It only compiles in the context copy code if
+   this macro is defined. */
+#define __COPY_CONTEXT_SIZE ((size_t) (uintptr_t) &((struct ucontext *) 0)->oldmask)
 
 typedef union sigval
 {
-- 
2.1.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD *
  2015-03-31 17:47 [PATCH 0/3] Make detailled exception information available to signal handlers Jon TURNEY
@ 2015-03-31 17:47 ` Jon TURNEY
  2015-03-31 19:11   ` Corinna Vinschen
  2015-03-31 17:47 ` [PATCH 2/3] Make mcontext and stack information available to signal handlers Jon TURNEY
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2015-03-31 17:47 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon TURNEY

	* 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] Rename struct ucontext to struct __mcontext
  2015-03-31 17:47 ` [PATCH 1/3] Rename struct ucontext to struct __mcontext Jon TURNEY
@ 2015-03-31 18:37   ` Corinna Vinschen
  0 siblings, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2015-03-31 18:37 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

On Mar 31 18:46, Jon TURNEY wrote:
> 	* include/cygwin/signal.h : Rename struct ucontext to struct
> 	__mcontext.  Remove unused member _internal.  Fix differences from
> 	the Win32 API CONTEXT type.

Patch is ok, except for the __COPY_CONTEXT_SIZE part.  This requires
a change to stay backward compatible which I apply after your patch.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] Make mcontext and stack information available to signal handlers
  2015-03-31 17:47 ` [PATCH 2/3] Make mcontext and stack information available to signal handlers Jon TURNEY
@ 2015-03-31 18:46   ` Corinna Vinschen
  0 siblings, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2015-03-31 18:46 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]

On Mar 31 18:46, Jon TURNEY wrote:
> Add ucontext.h header, defining ucontext_t and mcontext_t types.
> 
> Provide sigaction sighandlers with a ucontext_t parameter, containing stack and
> context information.
> 
> XXX: How do we indicate context information is not available (si_cyg == NULL)

If si_cyg is NULL, fetch the current context via RtlCaptureContext.

Two minor nits.  With the outlined changes, ok to apply.

> +      if (thissi.si_cyg)
> +        {
> +          memcpy (&context.uc_mcontext, ((cygwin_exception *)thissi.si_cyg)->context(), sizeof(CONTEXT));
> +        }
> +

At this point, please add a FIXME comment rambling along about
having to tweak this code when we implement sigaltstack.

> +      context.uc_stack.ss_sp = NtCurrentTeb ()->Tib.StackBase;
> +      context.uc_stack.ss_flags = 0;
> +      if (!NtCurrentTeb ()->DeallocationStack)
> +        context.uc_stack.ss_size = (uintptr_t)NtCurrentTeb ()->Tib.StackLimit - (uintptr_t)NtCurrentTeb ()->Tib.StackBase;
> +      else
> +        context.uc_stack.ss_size = (uintptr_t)NtCurrentTeb ()->DeallocationStack - (uintptr_t)NtCurrentTeb ()->Tib.StackBase;
> +
> +#ifndef _SYS_UCONTEXT_H_
> +#define _SYS_UCONTEXT_H_
> +
> +#include <cygwin/signal.h>
> +#include <sys/signal.h>

Just include <signal.h> as on Linux, unless there's a really good reason.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Make detailled exception information available to signal handlers
  2015-03-31 17:47 [PATCH 0/3] Make detailled exception information available to signal handlers Jon TURNEY
                   ` (2 preceding siblings ...)
  2015-03-31 17:47 ` [PATCH 1/3] Rename struct ucontext to struct __mcontext Jon TURNEY
@ 2015-03-31 19:02 ` Corinna Vinschen
  3 siblings, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2015-03-31 19:02 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]

On Mar 31 18:46, Jon TURNEY wrote:
> Thanks for your help so far.  Here's another attempt at this.
> 
> Questions:
> 
> The ContextFlags member of the CONTEXT type is named cr2 in struct __mcontext. I 
> don't understand how that can be right.

It isn't.  Please rename cr2 to ctx_flags and add a uint64_t resp.
uint32_t value called "cr2" as last member after "oldmask" to struct
__mcontext.  We're discussing filling cr2 later, it's certainly not
a pressing issue.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD *
  2015-03-31 17:47 ` [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD * Jon TURNEY
@ 2015-03-31 19:11   ` Corinna Vinschen
  0 siblings, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2015-03-31 19:11 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 2331 bytes --]

On Mar 31 18:46, Jon TURNEY wrote:
> 	* 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.


> 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;

I would prefer if CW_EXCEPTION_RECORD_FROM_SIGINFO_T takes a buffer
address as additional parameter and then memcpy's the EXCEPTION_RECORD
over to this address.  This decouples the EXCEPTION_RECORDs in Cygwin
from the one in the application and no side is huffy if the other side
changes the contents.

> 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

There's a

#define CW_EXCEPTION_RECORD_FROM_SIGINFO_T CW_EXCEPTION_RECORD_FROM_SIGINFO_T

missing here.  With these changes, ok to apply.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-31 19:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31 17:47 [PATCH 0/3] Make detailled exception information available to signal handlers Jon TURNEY
2015-03-31 17:47 ` [PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD * Jon TURNEY
2015-03-31 19:11   ` Corinna Vinschen
2015-03-31 17:47 ` [PATCH 2/3] Make mcontext and stack information available to signal handlers 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 19:02 ` [PATCH 0/3] Make detailled exception information available to signal handlers Corinna Vinschen

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).