Switch VEH to VCH and allow disabling of SEH completely.
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 26 Sep 2017 18:34:58 +0000 (14:34 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 26 Sep 2017 19:39:18 +0000 (15:39 -0400)
commit1825cbdbdf08ed4bd6fd6794852596078953298a
tree5c76215fe2cfc87729b8c5f03fb8f5cd5277a9c2
parent7fb89e81aa26d546c468a780b57cbdd5ab189ec2
Switch VEH to VCH and allow disabling of SEH completely.

Exception handling on Windows is unfortunately a bit complicated.
But essentially the VEH Handlers we currently have are running too
early.

This was a problem as it ran so early it also swallowed C++ exceptions
and other software exceptions which the system could have very well
recovered from.

So instead we use a sequence of chains to for the exception handlers to
run as late as possible. You really can't get any later than this.

Please read the comment in the patch for more details.

I'm also providing a switch to allow people to turn off the exception
handling entirely. In case it does present a problem with their code.

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13911, #12110

Differential Revision: https://phabricator.haskell.org/D3911
docs/users_guide/8.4.1-notes.rst
docs/users_guide/runtime_control.rst
includes/rts/Flags.h
libraries/base/GHC/RTS/Flags.hsc
libraries/base/changelog.md
rts/RtsFlags.c
rts/RtsMain.c
rts/win32/veh_excn.c
rts/win32/veh_excn.h