author | xlu |
Wed, 24 Dec 2008 19:13:53 -0800 | |
changeset 1889 | 24b003a6fe46 |
parent 1 | 489c9b5090e2 |
child 2129 | e810a33b5c67 |
child 2105 | 347008ce7984 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
2 |
* Copyright 2003-2007 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 |
*/ |
|
24 |
||
25 |
||
26 |
class VM_ReportJavaOutOfMemory; |
|
27 |
||
28 |
class VMError : public StackObj { |
|
29 |
friend class VM_ReportJavaOutOfMemory; |
|
30 |
||
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 |
|
38 |
||
39 |
const char * _message; |
|
40 |
||
41 |
Thread * _thread; // NULL if it's native thread |
|
42 |
||
43 |
||
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 |
|
50 |
||
51 |
// additional info for VM internal errors |
|
52 |
const char * _filename; |
|
1889
24b003a6fe46
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
1
diff
changeset
|
53 |
size_t _lineno; |
1 | 54 |
|
55 |
// used by fatal error handler |
|
56 |
int _current_step; |
|
57 |
const char * _current_step_info; |
|
58 |
int _verbose; |
|
59 |
||
60 |
// used by reporting about OOM |
|
61 |
size_t _size; |
|
62 |
||
63 |
// set signal handlers on Solaris/Linux or the default exception filter |
|
64 |
// on Windows, to handle recursive crashes. |
|
65 |
void reset_signal_handlers(); |
|
66 |
||
67 |
// handle -XX:+ShowMessageBoxOnError. buf is used to format the message string |
|
68 |
void show_message_box(char* buf, int buflen); |
|
69 |
||
70 |
// generate an error report |
|
71 |
void report(outputStream* st); |
|
72 |
||
73 |
// accessor |
|
74 |
const char* message() { return _message; } |
|
75 |
||
76 |
public: |
|
77 |
// Constructor for crashes |
|
78 |
VMError(Thread* thread, int sig, address pc, void* siginfo, void* context); |
|
79 |
// Constructor for VM internal errors |
|
80 |
VMError(Thread* thread, const char* message, const char* filename, int lineno); |
|
81 |
||
82 |
// Constructors for VM OOM errors |
|
83 |
VMError(Thread* thread, size_t size, const char* message, const char* filename, int lineno); |
|
84 |
// Constructor for non-fatal errors |
|
85 |
VMError(const char* message); |
|
86 |
||
87 |
// return a string to describe the error |
|
88 |
char *error_string(char* buf, int buflen); |
|
89 |
||
90 |
// main error reporting function |
|
91 |
void report_and_die(); |
|
92 |
||
93 |
// reporting OutOfMemoryError |
|
94 |
void report_java_out_of_memory(); |
|
95 |
||
96 |
// returns original flags for signal, if it was resetted, or -1 if |
|
97 |
// signal was not changed by error reporter |
|
98 |
static int get_resetted_sigflags(int sig); |
|
99 |
||
100 |
// returns original handler for signal, if it was resetted, or NULL if |
|
101 |
// signal was not changed by error reporter |
|
102 |
static address get_resetted_sighandler(int sig); |
|
103 |
}; |