< prev index next >

src/os/aix/vm/vmError_aix.cpp

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "runtime/arguments.hpp"
  27 #include "runtime/os.hpp"
  28 #include "runtime/thread.hpp"
  29 #include "utilities/vmError.hpp"
  30 
  31 #include <sys/types.h>
  32 #include <sys/wait.h>
  33 #include <unistd.h>
  34 #include <signal.h>
  35 
  36 void VMError::show_message_box(char *buf, int buflen) {

  37   bool yes;
  38   do {
  39     error_string(buf, buflen);
  40     int len = (int)strlen(buf);
  41     char *p = &buf[len];
  42 
  43     jio_snprintf(p, buflen - len,
  44                  "\n\n"
  45                  "Do you want to debug the problem?\n\n"
  46                  "To debug, run 'dbx -a %d'; then switch to thread tid " INTX_FORMAT ", k-tid " INTX_FORMAT "\n"
  47                  "Enter 'yes' to launch dbx automatically (PATH must include dbx)\n"
  48                  "Otherwise, press RETURN to abort...",
  49                  os::current_process_id(),
  50                  os::current_thread_id(), thread_self());
  51 
  52     yes = os::message_box("Unexpected Error", buf);
  53 
  54     if (yes) {
  55       // yes, user asked VM to launch debugger
  56       jio_snprintf(buf, buflen, "dbx -a %d", os::current_process_id());
  57 
  58       os::fork_and_exec(buf);
  59       yes = false;


 100 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
 101 
 102   // Unmask current signal.
 103   sigset_t newset;
 104   sigemptyset(&newset);
 105   sigaddset(&newset, sig);
 106   // and all other synchronous signals too.
 107   for (int i = 0; i < NUM_SIGNALS; i++) {
 108     sigaddset(&newset, SIGNALS[i]);
 109   }
 110   sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 111 
 112   // support safefetch faults in error handling
 113   ucontext_t* const uc = (ucontext_t*) ucVoid;
 114   address const pc = uc ? os::Aix::ucontext_get_pc(uc) : NULL;
 115   if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
 116     os::Aix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
 117     return;
 118   }
 119 
 120   VMError err(NULL, sig, pc, info, ucVoid);
 121   err.report_and_die();
 122 }
 123 
 124 void VMError::reset_signal_handlers() {
 125   sigset_t newset;
 126   sigemptyset(&newset);
 127 
 128   for (int i = 0; i < NUM_SIGNALS; i++) {
 129     save_signal(i, SIGNALS[i]);
 130     os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
 131     sigaddset(&newset, SIGNALS[i]);
 132   }
 133 
 134   sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 135 }


  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "runtime/arguments.hpp"
  27 #include "runtime/os.hpp"
  28 #include "runtime/thread.hpp"
  29 #include "utilities/vmError.hpp"
  30 
  31 #include <sys/types.h>
  32 #include <sys/wait.h>
  33 #include <unistd.h>
  34 #include <signal.h>
  35 
  36 void VMError::show_message_box(char *buf, int buflen, int id, const char* message, const char* detail_fmt,
  37                                va_list detail_args, address pc, const char* filename, int lineno) {
  38   bool yes;
  39   do {
  40     error_string(buf, buflen, id, message, detail_fmt, detail_args, pc, filename, lineno);
  41     int len = (int)strlen(buf);
  42     char *p = &buf[len];
  43 
  44     jio_snprintf(p, buflen - len,
  45                  "\n\n"
  46                  "Do you want to debug the problem?\n\n"
  47                  "To debug, run 'dbx -a %d'; then switch to thread tid " INTX_FORMAT ", k-tid " INTX_FORMAT "\n"
  48                  "Enter 'yes' to launch dbx automatically (PATH must include dbx)\n"
  49                  "Otherwise, press RETURN to abort...",
  50                  os::current_process_id(),
  51                  os::current_thread_id(), thread_self());
  52 
  53     yes = os::message_box("Unexpected Error", buf);
  54 
  55     if (yes) {
  56       // yes, user asked VM to launch debugger
  57       jio_snprintf(buf, buflen, "dbx -a %d", os::current_process_id());
  58 
  59       os::fork_and_exec(buf);
  60       yes = false;


 101 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
 102 
 103   // Unmask current signal.
 104   sigset_t newset;
 105   sigemptyset(&newset);
 106   sigaddset(&newset, sig);
 107   // and all other synchronous signals too.
 108   for (int i = 0; i < NUM_SIGNALS; i++) {
 109     sigaddset(&newset, SIGNALS[i]);
 110   }
 111   sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 112 
 113   // support safefetch faults in error handling
 114   ucontext_t* const uc = (ucontext_t*) ucVoid;
 115   address const pc = uc ? os::Aix::ucontext_get_pc(uc) : NULL;
 116   if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
 117     os::Aix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
 118     return;
 119   }
 120 
 121   VMError::report_and_die(NULL, sig, pc, info, ucVoid);

 122 }
 123 
 124 void VMError::reset_signal_handlers() {
 125   sigset_t newset;
 126   sigemptyset(&newset);
 127 
 128   for (int i = 0; i < NUM_SIGNALS; i++) {
 129     save_signal(i, SIGNALS[i]);
 130     os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
 131     sigaddset(&newset, SIGNALS[i]);
 132   }
 133 
 134   sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 135 }
< prev index next >