From 2c1e724ba46299696570c06440752d8729c60d2b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 19 Mar 2014 16:08:21 +0000 Subject: [PATCH] * exception.h (exception::handle_while_being_debugged): Declare. (exception::exception): Install unhandled exception filter. * exceptions.cc (exception::handle_while_being_debugged): New method. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/exception.h | 4 +++- winsup/cygwin/exceptions.cc | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 66ab3f727..4565d1b2b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2014-03-19 Corinna Vinschen + + * exception.h (exception::handle_while_being_debugged): Declare. + (exception::exception): Install unhandled exception filter. + * exceptions.cc (exception::handle_while_being_debugged): New method. + 2014-03-19 Corinna Vinschen * passwd.cc (pg_ent::enumerate_ad): Ignore primary domain in list of diff --git a/winsup/cygwin/exception.h b/winsup/cygwin/exception.h index 6792536c9..673f3b3b5 100644 --- a/winsup/cygwin/exception.h +++ b/winsup/cygwin/exception.h @@ -111,6 +111,7 @@ class exception #ifdef __x86_64__ static bool handler_installed; static int handle (LPEXCEPTION_POINTERS); + static int handle_while_being_debugged (LPEXCEPTION_POINTERS); #else exception_list el; exception_list *save; @@ -123,7 +124,8 @@ public: if (!handler_installed) { handler_installed = true; - AddVectoredExceptionHandler (1, handle); + SetUnhandledExceptionFilter (handle); + AddVectoredExceptionHandler (1, handle_while_being_debugged); } #else save = _except_list; diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index e9e8778c2..fac65bf01 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -555,6 +555,14 @@ rtl_unwind (exception_list *frame, PEXCEPTION_RECORD e) bool exception::handler_installed NO_COPY; +int +exception::handle_while_being_debugged (LPEXCEPTION_POINTERS ep) +{ + if (being_debugged ()) + return handle (ep); + return EXCEPTION_CONTINUE_SEARCH; +} + int exception::handle (LPEXCEPTION_POINTERS ep) #else