comparison 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
comparison
equal deleted inserted replaced
2025:b03e6b4c7c75 2068:1e637defdda6
78 #endif 78 #endif
79 79
80 // put OS-includes here 80 // put OS-includes here
81 # include <dlfcn.h> 81 # include <dlfcn.h>
82 # include <errno.h> 82 # include <errno.h>
83 # include <exception>
83 # include <link.h> 84 # include <link.h>
84 # include <poll.h> 85 # include <poll.h>
85 # include <pthread.h> 86 # include <pthread.h>
86 # include <pwd.h> 87 # include <pwd.h>
87 # include <schedctl.h> 88 # include <schedctl.h>
1473 sigset_t* os::Solaris::allowdebug_blocked_signals() { 1474 sigset_t* os::Solaris::allowdebug_blocked_signals() {
1474 assert(signal_sets_initialized, "Not initialized"); 1475 assert(signal_sets_initialized, "Not initialized");
1475 return &allowdebug_blocked_sigs; 1476 return &allowdebug_blocked_sigs;
1476 } 1477 }
1477 1478
1479
1480 void _handle_uncaught_cxx_exception() {
1481 VMError err("An uncaught C++ exception");
1482 err.report_and_die();
1483 }
1484
1485
1478 // First crack at OS-specific initialization, from inside the new thread. 1486 // First crack at OS-specific initialization, from inside the new thread.
1479 void os::initialize_thread() { 1487 void os::initialize_thread() {
1480 int r = thr_main() ; 1488 int r = thr_main() ;
1481 guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ; 1489 guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
1482 if (r) { 1490 if (r) {
1562 // bound under T1. This is frequently the case for the primordial thread. 1570 // bound under T1. This is frequently the case for the primordial thread.
1563 // If we were ever to reenable this mechanism we would need to 1571 // If we were ever to reenable this mechanism we would need to
1564 // use the dynamic check for T2 libthread. 1572 // use the dynamic check for T2 libthread.
1565 1573
1566 os::Solaris::init_thread_fpu_state(); 1574 os::Solaris::init_thread_fpu_state();
1575 std::set_terminate(_handle_uncaught_cxx_exception);
1567 } 1576 }
1568 1577
1569 1578
1570 1579
1571 // Free Solaris resources related to the OSThread 1580 // Free Solaris resources related to the OSThread