summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-03-04 11:56:42 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-03-04 11:56:42 +0000
commit4e3c8d94251bb8a010e1656e824a46d4c2a14119 (patch)
tree620786b19e695b3ae2fb05a438c2dcafc5ba00ae
parent17ff765184829731ca171ddcbcba19bf92b84202 (diff)
downloadcygnal-4e3c8d94251bb8a010e1656e824a46d4c2a14119.tar.gz
cygnal-4e3c8d94251bb8a010e1656e824a46d4c2a14119.tar.bz2
cygnal-4e3c8d94251bb8a010e1656e824a46d4c2a14119.zip
* exception.h (exception::handler_installed): Remove.
(exception::exception): Remove old code. Manually install SEH handler instead. (exception::~exception): For x86_64, define frame end label. * exceptions.cc (exception::handler_installed): Remove.
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/exception.h29
-rw-r--r--winsup/cygwin/exceptions.cc2
3 files changed, 25 insertions, 14 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c7abec5e7..74cfc9653 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+2014-03-04 Corinna Vinschen <corinna@vinschen.de>
+
+ * exception.h (exception::handler_installed): Remove.
+ (exception::exception): Remove old code. Manually install SEH handler
+ instead.
+ (exception::~exception): For x86_64, define frame end label.
+ * exceptions.cc (exception::handler_installed): Remove.
+
2014-03-03 Corinna Vinschen <corinna@vinschen.de>
* exception.h (exception::exception): Install vectored exception
diff --git a/winsup/cygwin/exception.h b/winsup/cygwin/exception.h
index 95d8311fc..5b8b6da77 100644
--- a/winsup/cygwin/exception.h
+++ b/winsup/cygwin/exception.h
@@ -109,7 +109,6 @@ extern exception_list *_except_list asm ("%fs:0");
class exception
{
#ifdef __x86_64__
- static bool handler_installed;
static int handle (LPEXCEPTION_POINTERS);
#else
exception_list el;
@@ -120,16 +119,16 @@ public:
exception () __attribute__ ((always_inline))
{
#ifdef __x86_64__
- if (!handler_installed)
- {
- handler_installed = true;
- /* The unhandled exception filter goes first. It won't work if the
- executable is debugged, but then the vectored continue handler
- kicks in. For some reason the vectored continue handler doesn't
- get called if no unhandled exception filter is installed. */
- SetUnhandledExceptionFilter (handle);
- AddVectoredExceptionHandler (1, handle);
- }
+ /* Manually install SEH handler. */
+ asm (".l_startframe: \n\
+ .seh_handler __C_specific_handler, @except \n\
+ .seh_handlerdata \n\
+ .long 1 \n\
+ .rva .l_startframe, \
+ .l_endframe, \
+ _ZN9exception6handleEP19_EXCEPTION_POINTERS, \
+ .l_endframe \n\
+ .text \n");
#else
save = _except_list;
el.handler = handle;
@@ -137,7 +136,13 @@ public:
_except_list = &el;
#endif /* __x86_64__ */
};
-#ifndef __x86_64__
+#ifdef __x86_64__
+ ~exception () __attribute__ ((always_inline)) {
+ asm (" nop \n\
+ .l_endframe: \n\
+ nop \n");
+ }
+#else
~exception () __attribute__ ((always_inline)) { _except_list = save; }
#endif /* !__x86_64__ */
};
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index ceddbbca5..4b1db9d62 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -553,8 +553,6 @@ rtl_unwind (exception_list *frame, PEXCEPTION_RECORD e)
#define CYG_EXC_CONTINUE_EXECUTION EXCEPTION_CONTINUE_EXECUTION
#define CYG_EXC_CONTINUE_SEARCH EXCEPTION_CONTINUE_SEARCH
-bool exception::handler_installed NO_COPY;
-
int
exception::handle (LPEXCEPTION_POINTERS ep)
#else