[PATCH] Make EXCEPTION_POINTERS available to signal handlers
Mon Mar 30 17:33:00 GMT 2015
Thanks for your comments.
> We should remove or rename struct ucontext in cygwin/signal.h, so we
> can use that name for your above struct __ucontext. That leads to the
> next point...
Ok, building on your clean-up, this is [1/2]
> * Since struct ucontext from cygwin/signal.h is actually a redefinition
> of CONTEXT + an oldmask value. it's basically the Cygwin/Windows
> representation of gregset_t + fpregset_t + cr2 + oldmask, aka
> As for oldmask, this can be fetched easily from _my_tls, so in theory
> we can use the current definition of ucontext from cygwin/signal.h as
> But this drops the EXCEPTION_RECORD. I'm not sure it belongs here.
> Keep in mind that a signal handler is not only called in case an
> exception occured. I think the context is all a signal handler needs.
Yes, I had my doubts that EXCEPTION_RECORD didn't belong ucontext.
I've writen [2/2] to just provide mcontext_t (= CONTEXT) as part of the
But ultimately, I'd like to have access to EXCEPTION_RECORD to drive some
Windows-specific crash reporting code, so I'll take another look at how that
might be done...
> * As for stack_t, we have that. It's defined in newlib's sys/signal.h.
> The stack base and stack size can be fetched from the TEB; with a
> test for a user-defined stack, see pthread_wrapper in miscfuncs.cc.
> While we're at it we should contemplate to define SIGSTKSZ and
> MINSIGSTKSZ along the lines of 64K, I guess.
For the moment, I have omitted the POSIX-required uc_link, uc_sigmask and
uc_stack members from ucontext_t. They can be added when I understand how to
give them meaningful values.
Jon TURNEY (2):
Rename struct ucontext to struct mcontext
Make CONTEXT available to signal handlers
winsup/cygwin/ChangeLog | 12 ++++++++++++
winsup/cygwin/exceptions.cc | 13 +++++++++++--
winsup/cygwin/include/cygwin/signal.h | 16 +++++++++-------
winsup/cygwin/include/sys/ucontext.h | 22 ++++++++++++++++++++++
winsup/cygwin/include/ucontext.h | 16 ++++++++++++++++
5 files changed, 70 insertions(+), 9 deletions(-)
create mode 100644 winsup/cygwin/include/sys/ucontext.h
create mode 100644 winsup/cygwin/include/ucontext.h
More information about the Cygwin-patches