Mercurial > hg > graal-jvmci-8
diff src/os/solaris/vm/os_solaris.cpp @ 2068:1e637defdda6
6961186: Better VM handling of unexpected exceptions from application native code
Summary: Trap uncaught C++ exception on Windows and Solaris and generate hs_err report.
Reviewed-by: coleenp, bobv, dholmes
author | zgu |
---|---|
date | Wed, 22 Dec 2010 11:24:21 -0500 |
parents | 54f5dd2aa1d9 |
children | 5a1e52a439fa 039eb4201e06 |
line wrap: on
line diff
--- a/src/os/solaris/vm/os_solaris.cpp Tue Dec 14 15:10:52 2010 -0500 +++ b/src/os/solaris/vm/os_solaris.cpp Wed Dec 22 11:24:21 2010 -0500 @@ -80,6 +80,7 @@ // put OS-includes here # include <dlfcn.h> # include <errno.h> +# include <exception> # include <link.h> # include <poll.h> # include <pthread.h> @@ -1475,6 +1476,13 @@ return &allowdebug_blocked_sigs; } + +void _handle_uncaught_cxx_exception() { + VMError err("An uncaught C++ exception"); + err.report_and_die(); +} + + // First crack at OS-specific initialization, from inside the new thread. void os::initialize_thread() { int r = thr_main() ; @@ -1564,6 +1572,7 @@ // use the dynamic check for T2 libthread. os::Solaris::init_thread_fpu_state(); + std::set_terminate(_handle_uncaught_cxx_exception); }