src/share/vm/utilities/vmError.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7089790_shared Sdiff src/share/vm/utilities

src/share/vm/utilities/vmError.cpp

Print this page
rev 2695 : shared changes


  28 #include "runtime/arguments.hpp"
  29 #include "runtime/frame.inline.hpp"
  30 #include "runtime/init.hpp"
  31 #include "runtime/os.hpp"
  32 #include "runtime/thread.hpp"
  33 #include "runtime/vmThread.hpp"
  34 #include "runtime/vm_operations.hpp"
  35 #include "utilities/debug.hpp"
  36 #include "utilities/decoder.hpp"
  37 #include "utilities/defaultStream.hpp"
  38 #include "utilities/errorReporter.hpp"
  39 #include "utilities/top.hpp"
  40 #include "utilities/vmError.hpp"
  41 
  42 // List of environment variables that should be reported in error log file.
  43 const char *env_list[] = {
  44   // All platforms
  45   "JAVA_HOME", "JRE_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH",
  46   "JAVA_COMPILER", "PATH", "USERNAME",
  47 
  48   // Env variables that are defined on Solaris/Linux
  49   "LD_LIBRARY_PATH", "LD_PRELOAD", "SHELL", "DISPLAY",
  50   "HOSTTYPE", "OSTYPE", "ARCH", "MACHTYPE",
  51 
  52   // defined on Linux
  53   "LD_ASSUME_KERNEL", "_JAVA_SR_SIGNUM",
  54 





  55   // defined on Windows
  56   "OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR",
  57 
  58   (const char *)0
  59 };
  60 
  61 // Fatal error handler for internal errors and crashes.
  62 //
  63 // The default behavior of fatal error handler is to print a brief message
  64 // to standard out (defaultStream::output_fd()), then save detailed information
  65 // into an error report file (hs_err_pid<pid>.log) and abort VM. If multiple
  66 // threads are having troubles at the same time, only one error is reported.
  67 // The thread that is reporting error will abort VM when it is done, all other
  68 // threads are blocked forever inside report_and_die().
  69 
  70 // Constructor for crashes
  71 VMError::VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) {
  72     _thread = thread;
  73     _id = sig;
  74     _pc   = pc;


 941     }
 942 
 943     log.set_fd(-1);
 944     log_done = true;
 945   }
 946 
 947 
 948   static bool skip_OnError = false;
 949   if (!skip_OnError && OnError && OnError[0]) {
 950     skip_OnError = true;
 951 
 952     out.print_raw_cr("#");
 953     out.print_raw   ("# -XX:OnError=\"");
 954     out.print_raw   (OnError);
 955     out.print_raw_cr("\"");
 956 
 957     char* cmd;
 958     const char* ptr = OnError;
 959     while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
 960       out.print_raw   ("#   Executing ");
 961 #if defined(LINUX)
 962       out.print_raw   ("/bin/sh -c ");
 963 #elif defined(SOLARIS)
 964       out.print_raw   ("/usr/bin/sh -c ");
 965 #endif
 966       out.print_raw   ("\"");
 967       out.print_raw   (cmd);
 968       out.print_raw_cr("\" ...");
 969 
 970       os::fork_and_exec(cmd);
 971     }
 972 
 973     // done with OnError
 974     OnError = NULL;
 975   }
 976 
 977   static bool skip_bug_url = !should_report_bug(first_error->_id);
 978   if (!skip_bug_url) {
 979     skip_bug_url = true;
 980 
 981     out.print_raw_cr("#");




  28 #include "runtime/arguments.hpp"
  29 #include "runtime/frame.inline.hpp"
  30 #include "runtime/init.hpp"
  31 #include "runtime/os.hpp"
  32 #include "runtime/thread.hpp"
  33 #include "runtime/vmThread.hpp"
  34 #include "runtime/vm_operations.hpp"
  35 #include "utilities/debug.hpp"
  36 #include "utilities/decoder.hpp"
  37 #include "utilities/defaultStream.hpp"
  38 #include "utilities/errorReporter.hpp"
  39 #include "utilities/top.hpp"
  40 #include "utilities/vmError.hpp"
  41 
  42 // List of environment variables that should be reported in error log file.
  43 const char *env_list[] = {
  44   // All platforms
  45   "JAVA_HOME", "JRE_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH",
  46   "JAVA_COMPILER", "PATH", "USERNAME",
  47 
  48   // Env variables that are defined on Solaris/Linux/BSD
  49   "LD_LIBRARY_PATH", "LD_PRELOAD", "SHELL", "DISPLAY",
  50   "HOSTTYPE", "OSTYPE", "ARCH", "MACHTYPE",
  51 
  52   // defined on Linux
  53   "LD_ASSUME_KERNEL", "_JAVA_SR_SIGNUM",
  54 
  55   // defined on Darwin
  56   "DYLD_LIBRARY_PATH", "DYLD_FALLBACK_LIBRARY_PATH",
  57   "DYLD_FRAMEWORK_PATH", "DYLD_FALLBACK_FRAMEWORK_PATH",
  58   "DYLD_INSERT_LIBRARIES",
  59 
  60   // defined on Windows
  61   "OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR",
  62 
  63   (const char *)0
  64 };
  65 
  66 // Fatal error handler for internal errors and crashes.
  67 //
  68 // The default behavior of fatal error handler is to print a brief message
  69 // to standard out (defaultStream::output_fd()), then save detailed information
  70 // into an error report file (hs_err_pid<pid>.log) and abort VM. If multiple
  71 // threads are having troubles at the same time, only one error is reported.
  72 // The thread that is reporting error will abort VM when it is done, all other
  73 // threads are blocked forever inside report_and_die().
  74 
  75 // Constructor for crashes
  76 VMError::VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) {
  77     _thread = thread;
  78     _id = sig;
  79     _pc   = pc;


 946     }
 947 
 948     log.set_fd(-1);
 949     log_done = true;
 950   }
 951 
 952 
 953   static bool skip_OnError = false;
 954   if (!skip_OnError && OnError && OnError[0]) {
 955     skip_OnError = true;
 956 
 957     out.print_raw_cr("#");
 958     out.print_raw   ("# -XX:OnError=\"");
 959     out.print_raw   (OnError);
 960     out.print_raw_cr("\"");
 961 
 962     char* cmd;
 963     const char* ptr = OnError;
 964     while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
 965       out.print_raw   ("#   Executing ");
 966 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
 967       out.print_raw   ("/bin/sh -c ");
 968 #elif defined(SOLARIS)
 969       out.print_raw   ("/usr/bin/sh -c ");
 970 #endif
 971       out.print_raw   ("\"");
 972       out.print_raw   (cmd);
 973       out.print_raw_cr("\" ...");
 974 
 975       os::fork_and_exec(cmd);
 976     }
 977 
 978     // done with OnError
 979     OnError = NULL;
 980   }
 981 
 982   static bool skip_bug_url = !should_report_bug(first_error->_id);
 983   if (!skip_bug_url) {
 984     skip_bug_url = true;
 985 
 986     out.print_raw_cr("#");


src/share/vm/utilities/vmError.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File