6961186: Better VM handling of unexpected exceptions from application native code

Trap uncaught C++ exception on Windows and Solaris and generate hs_err report.

Reviewed-by: coleenp, bobv, dholmes
This commit is contained in:
Zhengyu Gu 2010-12-22 11:24:21 -05:00
parent 18324204ef
commit 7098ab98d5
2 changed files with 25 additions and 4 deletions

View file

@ -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 @@ sigset_t* os::Solaris::allowdebug_blocked_signals() {
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 @@ void os::initialize_thread() {
// use the dynamic check for T2 libthread.
os::Solaris::init_thread_fpu_state();
std::set_terminate(_handle_uncaught_cxx_exception);
}