From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: [Attn: gcc maintainers] Re: unhandled C++ exceptions not propagating
Date: Mon, 17 Aug 2020 20:13:59 +0200 [thread overview]
Message-ID: <20200817181359.GI3272@calimero.vinschen.de> (raw)
In-Reply-To: <9525d8c2-74af-5c04-8a04-d84df4b1f2ef@cornell.edu>
On Aug 17 13:36, Ken Brown via Cygwin wrote:
> On 8/16/2020 6:38 PM, Ken Brown via Cygwin wrote:
> > One further comment, and then I'll shut up
>
> I lied.
...which is ok.
> > and leave it to people who know what they're talking about: In the
> > 64-bit case, the function _Unwind_RaiseException in libgcc/unwind-seh.c
> > gets called, and it calls the Win32 function RaiseException as follows:
> >
> > RaiseException (STATUS_GCC_THROW, 0, 1, (ULONG_PTR *)&exc);
> >
> > Then the following comment appears:
> >
> > /* The exception handler installed in crt0 will continue any GCC
> > exception that reaches there (and isn't marked non-continuable).
> > Returning allows the C++ runtime to call std::terminate. */
> >
> > Apparently this doesn't actually happen.
>
> I'm beginning to think this is a bug in the Cygwin build of gcc. The file
> unwind-seh.c is compiled on 64-bit Cygwin because __SEH__ is defined. But
> it makes assumptions, such as those in the comment quoted above, that are
> not valid on Cygwin.
>
> In fact, if you look at the main exception handler on Cygwin
> (exceptions.cc:626), it is clear that the exception code STATUS_GCC_THROW
> does not lead to continuation. It falls under the default case:
>
> default:
> /* If we don't recognize the exception, we have to assume that
> we are doing structured exception handling, and we let
> something else handle it. */
> return ExceptionContinueSearch;
>
> [STATUS_GCC_THROW is 0x20474343, which shows up in the gdb output above as
> an unknown target exception.]
>
> So it seems to me that either Cygwin's exception handler has to learn to
> handle the exception codes defined in unwind-seh.c, or else gcc should be
> built with __SEH__ undefined.
>
> JonY, Achim, Corinna, am I missing something?
This stuff isn't really my strong point. IIUC the above comment correctly,
we might get away with adding another case to the exception handler switch:
#define STATUS_GCC_THROW 0x20474343
case STATUS_GCC_THROW:
return ExceptionContinueExecution;
Did you try that, by any chance?
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
next prev parent reply other threads:[~2020-08-17 18:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-15 23:38 David McFarland
2020-08-16 3:25 ` JonY
2020-08-16 3:53 ` Takashi Yano
2020-08-16 13:21 ` Ken Brown
2020-08-16 13:52 ` Takashi Yano
2020-08-16 14:56 ` Ken Brown
2020-08-16 22:38 ` Ken Brown
2020-08-17 17:36 ` [Attn: gcc maintainers] " Ken Brown
2020-08-17 18:13 ` Corinna Vinschen [this message]
2020-08-17 18:44 ` Achim Gratz
2020-08-17 19:06 ` Ken Brown
2020-08-17 20:40 ` Ken Brown
2020-08-17 20:50 ` Ken Brown
2020-08-18 0:09 ` JonY
2020-08-18 0:20 ` Ken Brown
2020-08-18 1:46 ` JonY
2020-08-16 14:17 ` David McFarland
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=20200817181359.GI3272@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@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).