vmError.hpp revision 1410
414N/A/*
881N/A * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
414N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
414N/A *
414N/A * This code is free software; you can redistribute it and/or modify it
414N/A * under the terms of the GNU General Public License version 2 only, as
414N/A * published by the Free Software Foundation.
414N/A *
414N/A * This code is distributed in the hope that it will be useful, but WITHOUT
414N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
414N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
414N/A * version 2 for more details (a copy is included in the LICENSE file that
414N/A * accompanied this code).
414N/A *
414N/A * You should have received a copy of the GNU General Public License version
414N/A * 2 along with this work; if not, write to the Free Software Foundation,
414N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
414N/A *
553N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
553N/A * CA 95054 USA or visit www.sun.com if you need additional information or
553N/A * have any questions.
414N/A *
414N/A */
414N/A
414N/A
414N/Aclass VM_ReportJavaOutOfMemory;
414N/A
414N/Aclass VMError : public StackObj {
414N/A friend class VM_ReportJavaOutOfMemory;
414N/A
414N/A enum ErrorType {
414N/A internal_error = 0xe0000000,
414N/A oom_error = 0xe0000001
414N/A };
414N/A int _id; // Solaris/Linux signals: 0 - SIGRTMAX
414N/A // Windows exceptions: 0xCxxxxxxx system errors
414N/A // 0x8xxxxxxx system warnings
414N/A
414N/A const char * _message;
414N/A const char * _detail_msg;
414N/A
414N/A Thread * _thread; // NULL if it's native thread
414N/A
414N/A
414N/A // additional info for crashes
414N/A address _pc; // faulting PC
414N/A void * _siginfo; // ExceptionRecord on Windows,
414N/A // siginfo_t on Solaris/Linux
414N/A void * _context; // ContextRecord on Windows,
414N/A // ucontext_t on Solaris/Linux
414N/A
414N/A // additional info for VM internal errors
414N/A const char * _filename;
414N/A int _lineno;
414N/A
414N/A // used by fatal error handler
414N/A int _current_step;
414N/A const char * _current_step_info;
414N/A int _verbose;
414N/A
414N/A // used by reporting about OOM
881N/A size_t _size;
881N/A
881N/A // set signal handlers on Solaris/Linux or the default exception filter
414N/A // on Windows, to handle recursive crashes.
414N/A void reset_signal_handlers();
881N/A
414N/A // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
414N/A void show_message_box(char* buf, int buflen);
414N/A
414N/A // generate an error report
414N/A void report(outputStream* st);
414N/A
414N/A // generate a stack trace
414N/A static void print_stack_trace(outputStream* st, JavaThread* jt,
414N/A char* buf, int buflen, bool verbose = false);
414N/A
414N/A // accessor
414N/A const char* message() const { return _message; }
414N/A const char* detail_msg() const { return _detail_msg; }
414N/A
414N/Apublic:
414N/A // Constructor for crashes
414N/A VMError(Thread* thread, int sig, address pc, void* siginfo, void* context);
414N/A // Constructor for VM internal errors
414N/A VMError(Thread* thread, const char* filename, int lineno,
414N/A const char* message, const char * detail_msg);
414N/A
414N/A // Constructor for VM OOM errors
414N/A VMError(Thread* thread, const char* filename, int lineno, size_t size,
414N/A const char* message);
414N/A // Constructor for non-fatal errors
414N/A VMError(const char* message);
414N/A
414N/A // return a string to describe the error
414N/A char *error_string(char* buf, int buflen);
414N/A
414N/A // main error reporting function
414N/A void report_and_die();
414N/A
414N/A // reporting OutOfMemoryError
414N/A void report_java_out_of_memory();
414N/A
414N/A // returns original flags for signal, if it was resetted, or -1 if
414N/A // signal was not changed by error reporter
414N/A static int get_resetted_sigflags(int sig);
414N/A
414N/A // returns original handler for signal, if it was resetted, or NULL if
414N/A // signal was not changed by error reporter
414N/A static address get_resetted_sighandler(int sig);
414N/A};
414N/A