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