< prev index next >

src/hotspot/share/utilities/vmError.hpp

Print this page
rev 56552 : imported patch 8218543-2


  15  * You should have received a copy of the GNU General Public License version
  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 #ifndef SHARE_UTILITIES_VMERROR_HPP
  26 #define SHARE_UTILITIES_VMERROR_HPP
  27 
  28 #include "utilities/globalDefinitions.hpp"
  29 
  30 class Decoder;
  31 class frame;
  32 class VM_ReportJavaOutOfMemory;
  33 
  34 class VMError : public AllStatic {
  35   friend class VM_ReportJavaOutOfMemory;
  36   friend class Decoder;
  37   friend class VMStructs;
  38 
  39   static int         _id;               // Solaris/Linux signals: 0 - SIGRTMAX
  40                                         // Windows exceptions: 0xCxxxxxxx system errors
  41                                         //                     0x8xxxxxxx system warnings
  42 
  43   static const char* _message;
  44   static char        _detail_msg[1024];
  45 
  46   static Thread*     _thread;           // NULL if it's native thread
  47 
  48   // additional info for crashes
  49   static address     _pc;               // faulting PC
  50   static void*       _siginfo;          // ExceptionRecord on Windows,
  51                                         // siginfo_t on Solaris/Linux
  52   static void*       _context;          // ContextRecord on Windows,
  53                                         // ucontext_t on Solaris/Linux
  54 
  55   // additional info for VM internal errors
  56   static const char* _filename;
  57   static int         _lineno;
  58 
  59   // used by reporting about OOM
  60   static size_t      _size;
  61 
  62   // used by fatal error handler
  63   static int         _current_step;
  64   static const char* _current_step_info;
  65 
  66   // Thread id of the first error. We must be able to handle native thread,
  67   // so use thread id instead of Thread* to identify thread.
  68   static volatile intptr_t first_error_tid;
  69 
  70   // Core dump status, false if we have been unable to write a core/minidump for some reason
  71   static bool coredump_status;
  72 
  73   // When coredump_status is set to true this will contain the name/path to the core/minidump,
  74   // if coredump_status if false, this will (hopefully) contain a useful error explaining why
  75   // no core/minidump has been written to disk
  76   static char coredump_message[O_BUFLEN];
  77 
  78   // Timeout handling:
  79   // Timestamp at which error reporting started; -1 if no error reporting in progress.
  80   static volatile jlong _reporting_start_time;
  81   // Whether or not error reporting did timeout.
  82   static volatile bool _reporting_did_timeout;
  83   // Timestamp at which the last error reporting step started; -1 if no error reporting
  84   //   in progress.
  85   static volatile jlong _step_start_time;
  86   // Whether or not the last error reporting step did timeout.
  87   static volatile bool _step_did_timeout;
  88 


 160                              const char* detail_fmt, va_list detail_args) ATTRIBUTE_PRINTF(6, 0);
 161 
 162   static void report_and_die(Thread* thread, const char* filename, int lineno, size_t size,
 163                              VMErrorType vm_err_type, const char* detail_fmt,
 164                              va_list detail_args) ATTRIBUTE_PRINTF(6, 0);
 165 
 166   static void report_and_die(const char* message);
 167 
 168   // reporting OutOfMemoryError
 169   static void report_java_out_of_memory(const char* message);
 170 
 171   // returns original flags for signal, if it was resetted, or -1 if
 172   // signal was not changed by error reporter
 173   static int get_resetted_sigflags(int sig);
 174 
 175   // returns original handler for signal, if it was resetted, or NULL if
 176   // signal was not changed by error reporter
 177   static address get_resetted_sighandler(int sig);
 178 
 179   // check to see if fatal error reporting is in progress
 180   static bool fatal_error_in_progress() { return first_error_tid != -1; }
 181 
 182   static intptr_t get_first_error_tid() { return first_error_tid; }
 183 
 184   // Called by the WatcherThread to check if error reporting has timed-out.
 185   //  Returns true if error reporting has not completed within the ErrorLogTimeout limit.
 186   static bool check_timeout();
 187 
 188   // Support for avoiding multiple asserts
 189   static bool is_error_reported();
 190 
 191   // Test vmassert(), fatal(), guarantee(), etc.
 192   NOT_PRODUCT(static void test_error_handler();)
 193   NOT_PRODUCT(static void controlled_crash(int how);)
 194 
 195   // returns an address which is guaranteed to generate a SIGSEGV on read,
 196   // for test purposes, which is not NULL and contains bits in every word
 197   static void* get_segfault_address();
 198 };
 199 #endif // SHARE_UTILITIES_VMERROR_HPP


  15  * You should have received a copy of the GNU General Public License version
  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 #ifndef SHARE_UTILITIES_VMERROR_HPP
  26 #define SHARE_UTILITIES_VMERROR_HPP
  27 
  28 #include "utilities/globalDefinitions.hpp"
  29 
  30 class Decoder;
  31 class frame;
  32 class VM_ReportJavaOutOfMemory;
  33 
  34 class VMError : public AllStatic {


  35   friend class VMStructs;
  36 
  37   static int         _id;               // Solaris/Linux signals: 0 - SIGRTMAX
  38                                         // Windows exceptions: 0xCxxxxxxx system errors
  39                                         //                     0x8xxxxxxx system warnings
  40 
  41   static const char* _message;
  42   static char        _detail_msg[1024];
  43 
  44   static Thread*     _thread;           // NULL if it's native thread
  45 
  46   // additional info for crashes
  47   static address     _pc;               // faulting PC
  48   static void*       _siginfo;          // ExceptionRecord on Windows,
  49                                         // siginfo_t on Solaris/Linux
  50   static void*       _context;          // ContextRecord on Windows,
  51                                         // ucontext_t on Solaris/Linux
  52 
  53   // additional info for VM internal errors
  54   static const char* _filename;
  55   static int         _lineno;
  56 
  57   // used by reporting about OOM
  58   static size_t      _size;
  59 
  60   // used by fatal error handler
  61   static int         _current_step;
  62   static const char* _current_step_info;
  63 
  64   // Thread id of the first error. We must be able to handle native thread,
  65   // so use thread id instead of Thread* to identify thread.
  66   static volatile intptr_t _first_error_tid;
  67 
  68   // Core dump status, false if we have been unable to write a core/minidump for some reason
  69   static bool coredump_status;
  70 
  71   // When coredump_status is set to true this will contain the name/path to the core/minidump,
  72   // if coredump_status if false, this will (hopefully) contain a useful error explaining why
  73   // no core/minidump has been written to disk
  74   static char coredump_message[O_BUFLEN];
  75 
  76   // Timeout handling:
  77   // Timestamp at which error reporting started; -1 if no error reporting in progress.
  78   static volatile jlong _reporting_start_time;
  79   // Whether or not error reporting did timeout.
  80   static volatile bool _reporting_did_timeout;
  81   // Timestamp at which the last error reporting step started; -1 if no error reporting
  82   //   in progress.
  83   static volatile jlong _step_start_time;
  84   // Whether or not the last error reporting step did timeout.
  85   static volatile bool _step_did_timeout;
  86 


 158                              const char* detail_fmt, va_list detail_args) ATTRIBUTE_PRINTF(6, 0);
 159 
 160   static void report_and_die(Thread* thread, const char* filename, int lineno, size_t size,
 161                              VMErrorType vm_err_type, const char* detail_fmt,
 162                              va_list detail_args) ATTRIBUTE_PRINTF(6, 0);
 163 
 164   static void report_and_die(const char* message);
 165 
 166   // reporting OutOfMemoryError
 167   static void report_java_out_of_memory(const char* message);
 168 
 169   // returns original flags for signal, if it was resetted, or -1 if
 170   // signal was not changed by error reporter
 171   static int get_resetted_sigflags(int sig);
 172 
 173   // returns original handler for signal, if it was resetted, or NULL if
 174   // signal was not changed by error reporter
 175   static address get_resetted_sighandler(int sig);
 176 
 177   // check to see if fatal error reporting is in progress
 178   static bool fatal_error_in_progress() { return _first_error_tid != -1; }
 179 
 180   static intptr_t get_first_error_tid() { return _first_error_tid; }
 181 
 182   // Called by the WatcherThread to check if error reporting has timed-out.
 183   //  Returns true if error reporting has not completed within the ErrorLogTimeout limit.
 184   static bool check_timeout();
 185 
 186   // Support for avoiding multiple asserts
 187   static bool is_error_reported();
 188 
 189   // Test vmassert(), fatal(), guarantee(), etc.
 190   NOT_PRODUCT(static void test_error_handler();)
 191   NOT_PRODUCT(static void controlled_crash(int how);)
 192 
 193   // returns an address which is guaranteed to generate a SIGSEGV on read,
 194   // for test purposes, which is not NULL and contains bits in every word
 195   static void* get_segfault_address();
 196 };
 197 #endif // SHARE_UTILITIES_VMERROR_HPP
< prev index next >