1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/utilities/vmError.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,103 @@ 1.4 +/* 1.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 + 1.29 +class VM_ReportJavaOutOfMemory; 1.30 + 1.31 +class VMError : public StackObj { 1.32 + friend class VM_ReportJavaOutOfMemory; 1.33 + 1.34 + enum ErrorType { 1.35 + internal_error = 0xe0000000, 1.36 + oom_error = 0xe0000001 1.37 + }; 1.38 + int _id; // Solaris/Linux signals: 0 - SIGRTMAX 1.39 + // Windows exceptions: 0xCxxxxxxx system errors 1.40 + // 0x8xxxxxxx system warnings 1.41 + 1.42 + const char * _message; 1.43 + 1.44 + Thread * _thread; // NULL if it's native thread 1.45 + 1.46 + 1.47 + // additional info for crashes 1.48 + address _pc; // faulting PC 1.49 + void * _siginfo; // ExceptionRecord on Windows, 1.50 + // siginfo_t on Solaris/Linux 1.51 + void * _context; // ContextRecord on Windows, 1.52 + // ucontext_t on Solaris/Linux 1.53 + 1.54 + // additional info for VM internal errors 1.55 + const char * _filename; 1.56 + int _lineno; 1.57 + 1.58 + // used by fatal error handler 1.59 + int _current_step; 1.60 + const char * _current_step_info; 1.61 + int _verbose; 1.62 + 1.63 + // used by reporting about OOM 1.64 + size_t _size; 1.65 + 1.66 + // set signal handlers on Solaris/Linux or the default exception filter 1.67 + // on Windows, to handle recursive crashes. 1.68 + void reset_signal_handlers(); 1.69 + 1.70 + // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string 1.71 + void show_message_box(char* buf, int buflen); 1.72 + 1.73 + // generate an error report 1.74 + void report(outputStream* st); 1.75 + 1.76 + // accessor 1.77 + const char* message() { return _message; } 1.78 + 1.79 +public: 1.80 + // Constructor for crashes 1.81 + VMError(Thread* thread, int sig, address pc, void* siginfo, void* context); 1.82 + // Constructor for VM internal errors 1.83 + VMError(Thread* thread, const char* message, const char* filename, int lineno); 1.84 + 1.85 + // Constructors for VM OOM errors 1.86 + VMError(Thread* thread, size_t size, const char* message, const char* filename, int lineno); 1.87 + // Constructor for non-fatal errors 1.88 + VMError(const char* message); 1.89 + 1.90 + // return a string to describe the error 1.91 + char *error_string(char* buf, int buflen); 1.92 + 1.93 + // main error reporting function 1.94 + void report_and_die(); 1.95 + 1.96 + // reporting OutOfMemoryError 1.97 + void report_java_out_of_memory(); 1.98 + 1.99 + // returns original flags for signal, if it was resetted, or -1 if 1.100 + // signal was not changed by error reporter 1.101 + static int get_resetted_sigflags(int sig); 1.102 + 1.103 + // returns original handler for signal, if it was resetted, or NULL if 1.104 + // signal was not changed by error reporter 1.105 + static address get_resetted_sighandler(int sig); 1.106 +};