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: Re: [PATCH] Make EXCEPTION_POINTERS available to signal handlers
Date: Mon, 30 Mar 2015 17:33:00 -0000	[thread overview]
Message-ID: <1427736757-13884-1-git-send-email-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20150330102129.GH29875@calimero.vinschen.de>

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
>    mcontext_t.
> 
>    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
>    mcontext_t.
> 
>    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 
ucontext_t.

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

-- 
2.1.4

  reply	other threads:[~2015-03-30 17:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 15:25 Jon TURNEY
2015-03-30 10:21 ` Corinna Vinschen
2015-03-30 17:33   ` Jon TURNEY [this message]
2015-03-30 17:33     ` [PATCH 1/2] Rename struct ucontext to struct mcontext Jon TURNEY
2015-03-30 18:47       ` Corinna Vinschen
2015-03-31 17:48         ` Jon TURNEY
2015-03-31 19:03           ` Corinna Vinschen
2015-03-30 17:33     ` [PATCH 2/2] Make CONTEXT available to signal handlers Jon TURNEY
2015-03-30 19:12       ` 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=1427736757-13884-1-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).