Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-03-29 02:31:53 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-03-29 02:31:53 +0400
commit20738749f60c85f58329015b7285289f6eb2b7c9 (patch)
treeddbd470d565d1bf74bb8c661633efe2b3afbc3ce /winsup/cygwin/exceptions.cc
parent58cc7a6498ce0da7f4acb79d837eadcf29c8a381 (diff)
* dcrt0.cc (dll_crt0_0): Install myfault exception handler on x86_64.
* exception.h (exception_list): Typedef as void on x86_64. (exception::handler_installed): Remove. (exception::handle_while_being_debugged): Remove. (exception::myfault_handle): Declare for x86_64. (exception::handle): Declare as ordinary exception handler on x86_64 as well. (exception::exception): Drop previous code (again). Install exception::handle as SEH handler. (exception::install_myfault_handler): New x86_64-only method to install exception::myfault_handle as VEH handler. Explain why. (exception::~exception): For x86_64, define frame end label (again). * exceptions.cc (CYG_EXC_CONTINUE_EXECUTION): Drop definition. (CYG_EXC_CONTINUE_SEARCH): Ditto. (exception::myfault_handle): New x86_64-only method, VEH handler to handle myfault exceptions. (exception::handle): Define as ordinary exception handler on x86_64 as well. Use ExceptionContinueExecution and ExceptionContinueSearch throughout instead of deleted Cygwin macros. Don't handle myfault exceptions on x86_64.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc48
1 files changed, 18 insertions, 30 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index d335a0807..c288913bd 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -545,55 +545,43 @@ rtl_unwind (exception_list *frame, PEXCEPTION_RECORD e)
popl %%ebx \n\
": : "r" (frame), "r" (e));
}
-#endif
-
-/* Main exception handler. */
+#endif /* __x86_64 */
#ifdef __x86_64__
-#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_while_being_debugged (LPEXCEPTION_POINTERS ep)
+/* myfault vectored exception handler */
+LONG
+exception::myfault_handle (LPEXCEPTION_POINTERS ep)
{
- if (being_debugged ())
- return handle (ep);
+ _cygtls& me = _my_tls;
+
+ if (me.andreas)
+ me.andreas->leave (); /* Return from a "san" caught fault */
return EXCEPTION_CONTINUE_SEARCH;
}
+#endif /* __x86_64 */
-int
-exception::handle (LPEXCEPTION_POINTERS ep)
-#else
-#define CYG_EXC_CONTINUE_EXECUTION ExceptionContinueExecution
-#define CYG_EXC_CONTINUE_SEARCH ExceptionContinueSearch
-
+/* Main exception handler. */
int
exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void *)
-#endif
{
static bool NO_COPY debugging;
_cygtls& me = _my_tls;
+#ifndef __x86_64__
if (me.andreas)
me.andreas->leave (); /* Return from a "san" caught fault */
-
-#ifdef __x86_64__
- EXCEPTION_RECORD *e = ep->ExceptionRecord;
- CONTEXT *in = ep->ContextRecord;
#endif
if (debugging && ++debugging < 500000)
{
SetThreadPriority (hMainThread, THREAD_PRIORITY_NORMAL);
- return CYG_EXC_CONTINUE_EXECUTION;
+ return ExceptionContinueExecution;
}
/* If we're exiting, tell Windows to keep looking for an
exception handler. */
if (exit_state || e->ExceptionFlags)
- return CYG_EXC_CONTINUE_SEARCH;
+ return ExceptionContinueSearch;
siginfo_t si = {};
si.si_code = SI_KERNEL;
@@ -662,7 +650,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void
1))
{
case MMAP_NORESERVE_COMMITED:
- return CYG_EXC_CONTINUE_EXECUTION;
+ return ExceptionContinueExecution;
case MMAP_RAISE_SIGBUS: /* MAP_NORESERVE page, commit failed, or
access to mmap page beyond EOF. */
si.si_signo = SIGBUS;
@@ -696,13 +684,13 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void
want CloseHandle to return an error. This can be revisited
if gcc ever supports Windows style structured exception
handling. */
- return CYG_EXC_CONTINUE_EXECUTION;
+ return ExceptionContinueExecution;
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 CYG_EXC_CONTINUE_SEARCH;
+ return ExceptionContinueSearch;
}
debug_printf ("In cygwin_except_handler exception %y at %p sp %p", e->ExceptionCode, in->_GR(ip), in->_GR(sp));
@@ -738,7 +726,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void
else
{
debugging = true;
- return CYG_EXC_CONTINUE_EXECUTION;
+ return ExceptionContinueExecution;
}
/* FIXME: Probably should be handled in signal processing code */
@@ -773,7 +761,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void
sig_send (NULL, si, &me); /* Signal myself */
me.incyg--;
e->ExceptionFlags = 0;
- return CYG_EXC_CONTINUE_EXECUTION;
+ return ExceptionContinueExecution;
}
/* Utilities to call a user supplied exception handler. */