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
1 /*
2 * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
26 class VM_ReportJavaOutOfMemory;
28 class VMError : public StackObj {
29 friend class VM_ReportJavaOutOfMemory;
31 enum ErrorType {
32 internal_error = 0xe0000000,
33 oom_error = 0xe0000001
34 };
35 int _id; // Solaris/Linux signals: 0 - SIGRTMAX
36 // Windows exceptions: 0xCxxxxxxx system errors
37 // 0x8xxxxxxx system warnings
39 const char * _message;
41 Thread * _thread; // NULL if it's native thread
44 // additional info for crashes
45 address _pc; // faulting PC
46 void * _siginfo; // ExceptionRecord on Windows,
47 // siginfo_t on Solaris/Linux
48 void * _context; // ContextRecord on Windows,
49 // ucontext_t on Solaris/Linux
51 // additional info for VM internal errors
52 const char * _filename;
53 int _lineno;
55 // used by fatal error handler
56 int _current_step;
57 const char * _current_step_info;
58 int _verbose;
60 // used by reporting about OOM
61 size_t _size;
63 // set signal handlers on Solaris/Linux or the default exception filter
64 // on Windows, to handle recursive crashes.
65 void reset_signal_handlers();
67 // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
68 void show_message_box(char* buf, int buflen);
70 // generate an error report
71 void report(outputStream* st);
73 // generate a stack trace
74 static void print_stack_trace(outputStream* st, JavaThread* jt,
75 char* buf, int buflen, bool verbose = false);
77 // accessor
78 const char* message() { return _message; }
80 public:
81 // Constructor for crashes
82 VMError(Thread* thread, int sig, address pc, void* siginfo, void* context);
83 // Constructor for VM internal errors
84 VMError(Thread* thread, const char* message, const char* filename, int lineno);
86 // Constructors for VM OOM errors
87 VMError(Thread* thread, size_t size, const char* message, const char* filename, int lineno);
88 // Constructor for non-fatal errors
89 VMError(const char* message);
91 // return a string to describe the error
92 char *error_string(char* buf, int buflen);
94 // main error reporting function
95 void report_and_die();
97 // reporting OutOfMemoryError
98 void report_java_out_of_memory();
100 // returns original flags for signal, if it was resetted, or -1 if
101 // signal was not changed by error reporter
102 static int get_resetted_sigflags(int sig);
104 // returns original handler for signal, if it was resetted, or NULL if
105 // signal was not changed by error reporter
106 static address get_resetted_sighandler(int sig);
107 };