* 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.
This commit is contained in:
Corinna Vinschen 2014-03-04 11:56:42 +00:00
parent 17ff765184
commit 4e3c8d9425
3 changed files with 25 additions and 14 deletions

View File

@ -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> 2014-03-03 Corinna Vinschen <corinna@vinschen.de>
* exception.h (exception::exception): Install vectored exception * exception.h (exception::exception): Install vectored exception

View File

@ -109,7 +109,6 @@ extern exception_list *_except_list asm ("%fs:0");
class exception class exception
{ {
#ifdef __x86_64__ #ifdef __x86_64__
static bool handler_installed;
static int handle (LPEXCEPTION_POINTERS); static int handle (LPEXCEPTION_POINTERS);
#else #else
exception_list el; exception_list el;
@ -120,16 +119,16 @@ public:
exception () __attribute__ ((always_inline)) exception () __attribute__ ((always_inline))
{ {
#ifdef __x86_64__ #ifdef __x86_64__
if (!handler_installed) /* Manually install SEH handler. */
{ asm (".l_startframe: \n\
handler_installed = true; .seh_handler __C_specific_handler, @except \n\
/* The unhandled exception filter goes first. It won't work if the .seh_handlerdata \n\
executable is debugged, but then the vectored continue handler .long 1 \n\
kicks in. For some reason the vectored continue handler doesn't .rva .l_startframe, \
get called if no unhandled exception filter is installed. */ .l_endframe, \
SetUnhandledExceptionFilter (handle); _ZN9exception6handleEP19_EXCEPTION_POINTERS, \
AddVectoredExceptionHandler (1, handle); .l_endframe \n\
} .text \n");
#else #else
save = _except_list; save = _except_list;
el.handler = handle; el.handler = handle;
@ -137,7 +136,13 @@ public:
_except_list = &el; _except_list = &el;
#endif /* __x86_64__ */ #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; } ~exception () __attribute__ ((always_inline)) { _except_list = save; }
#endif /* !__x86_64__ */ #endif /* !__x86_64__ */
}; };

View File

@ -553,8 +553,6 @@ rtl_unwind (exception_list *frame, PEXCEPTION_RECORD e)
#define CYG_EXC_CONTINUE_EXECUTION EXCEPTION_CONTINUE_EXECUTION #define CYG_EXC_CONTINUE_EXECUTION EXCEPTION_CONTINUE_EXECUTION
#define CYG_EXC_CONTINUE_SEARCH EXCEPTION_CONTINUE_SEARCH #define CYG_EXC_CONTINUE_SEARCH EXCEPTION_CONTINUE_SEARCH
bool exception::handler_installed NO_COPY;
int int
exception::handle (LPEXCEPTION_POINTERS ep) exception::handle (LPEXCEPTION_POINTERS ep)
#else #else