Tue, 11 May 2010 14:35:43 -0700
6931180: Migration to recent versions of MS Platform SDK
6951582: Build problems on win64
Summary: Changes to enable building JDK7 with Microsoft Visual Studio 2010
Reviewed-by: ohair, art, ccheung, dcubed
duke@435 | 1 | /* |
twisti@1819 | 2 | * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | |
duke@435 | 26 | class VM_ReportJavaOutOfMemory; |
duke@435 | 27 | |
duke@435 | 28 | class VMError : public StackObj { |
duke@435 | 29 | friend class VM_ReportJavaOutOfMemory; |
duke@435 | 30 | |
duke@435 | 31 | enum ErrorType { |
duke@435 | 32 | internal_error = 0xe0000000, |
duke@435 | 33 | oom_error = 0xe0000001 |
duke@435 | 34 | }; |
duke@435 | 35 | int _id; // Solaris/Linux signals: 0 - SIGRTMAX |
duke@435 | 36 | // Windows exceptions: 0xCxxxxxxx system errors |
duke@435 | 37 | // 0x8xxxxxxx system warnings |
duke@435 | 38 | |
duke@435 | 39 | const char * _message; |
duke@435 | 40 | |
duke@435 | 41 | Thread * _thread; // NULL if it's native thread |
duke@435 | 42 | |
duke@435 | 43 | |
duke@435 | 44 | // additional info for crashes |
duke@435 | 45 | address _pc; // faulting PC |
duke@435 | 46 | void * _siginfo; // ExceptionRecord on Windows, |
duke@435 | 47 | // siginfo_t on Solaris/Linux |
duke@435 | 48 | void * _context; // ContextRecord on Windows, |
duke@435 | 49 | // ucontext_t on Solaris/Linux |
duke@435 | 50 | |
duke@435 | 51 | // additional info for VM internal errors |
duke@435 | 52 | const char * _filename; |
twisti@1038 | 53 | int _lineno; |
duke@435 | 54 | |
duke@435 | 55 | // used by fatal error handler |
duke@435 | 56 | int _current_step; |
duke@435 | 57 | const char * _current_step_info; |
duke@435 | 58 | int _verbose; |
duke@435 | 59 | |
duke@435 | 60 | // used by reporting about OOM |
duke@435 | 61 | size_t _size; |
duke@435 | 62 | |
duke@435 | 63 | // set signal handlers on Solaris/Linux or the default exception filter |
duke@435 | 64 | // on Windows, to handle recursive crashes. |
duke@435 | 65 | void reset_signal_handlers(); |
duke@435 | 66 | |
duke@435 | 67 | // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string |
duke@435 | 68 | void show_message_box(char* buf, int buflen); |
duke@435 | 69 | |
duke@435 | 70 | // generate an error report |
duke@435 | 71 | void report(outputStream* st); |
duke@435 | 72 | |
twisti@1819 | 73 | // generate a stack trace |
twisti@1819 | 74 | static void print_stack_trace(outputStream* st, JavaThread* jt, |
twisti@1819 | 75 | char* buf, int buflen, bool verbose = false); |
twisti@1819 | 76 | |
duke@435 | 77 | // accessor |
duke@435 | 78 | const char* message() { return _message; } |
duke@435 | 79 | |
duke@435 | 80 | public: |
duke@435 | 81 | // Constructor for crashes |
duke@435 | 82 | VMError(Thread* thread, int sig, address pc, void* siginfo, void* context); |
duke@435 | 83 | // Constructor for VM internal errors |
duke@435 | 84 | VMError(Thread* thread, const char* message, const char* filename, int lineno); |
duke@435 | 85 | |
duke@435 | 86 | // Constructors for VM OOM errors |
duke@435 | 87 | VMError(Thread* thread, size_t size, const char* message, const char* filename, int lineno); |
duke@435 | 88 | // Constructor for non-fatal errors |
duke@435 | 89 | VMError(const char* message); |
duke@435 | 90 | |
duke@435 | 91 | // return a string to describe the error |
duke@435 | 92 | char *error_string(char* buf, int buflen); |
duke@435 | 93 | |
duke@435 | 94 | // main error reporting function |
duke@435 | 95 | void report_and_die(); |
duke@435 | 96 | |
duke@435 | 97 | // reporting OutOfMemoryError |
duke@435 | 98 | void report_java_out_of_memory(); |
duke@435 | 99 | |
duke@435 | 100 | // returns original flags for signal, if it was resetted, or -1 if |
duke@435 | 101 | // signal was not changed by error reporter |
duke@435 | 102 | static int get_resetted_sigflags(int sig); |
duke@435 | 103 | |
duke@435 | 104 | // returns original handler for signal, if it was resetted, or NULL if |
duke@435 | 105 | // signal was not changed by error reporter |
duke@435 | 106 | static address get_resetted_sighandler(int sig); |
duke@435 | 107 | }; |