Mercurial > hg > truffle
annotate src/share/vm/utilities/vmError.hpp @ 2196:d28def44457d
7017009: Secondary out of c-heap memory error reporting out of memory
Summary: Use os::malloc() to allocate buffer to read elf symbols and check for null
Reviewed-by: zgu, phh, dsamersoff, dholmes, dcubed
author | coleenp |
---|---|
date | Thu, 03 Feb 2011 21:30:08 -0500 |
parents | 36c186bcc085 |
children | 63d374c54045 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1490
diff
changeset
|
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1490
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1490
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1490
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_UTILITIES_VMERROR_HPP |
26 #define SHARE_VM_UTILITIES_VMERROR_HPP | |
27 | |
28 #include "utilities/globalDefinitions.hpp" | |
29 | |
0 | 30 |
31 class VM_ReportJavaOutOfMemory; | |
32 | |
33 class VMError : public StackObj { | |
34 friend class VM_ReportJavaOutOfMemory; | |
35 | |
36 enum ErrorType { | |
37 internal_error = 0xe0000000, | |
38 oom_error = 0xe0000001 | |
39 }; | |
40 int _id; // Solaris/Linux signals: 0 - SIGRTMAX | |
41 // Windows exceptions: 0xCxxxxxxx system errors | |
42 // 0x8xxxxxxx system warnings | |
43 | |
44 const char * _message; | |
1490
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
45 const char * _detail_msg; |
0 | 46 |
47 Thread * _thread; // NULL if it's native thread | |
48 | |
49 | |
50 // additional info for crashes | |
51 address _pc; // faulting PC | |
52 void * _siginfo; // ExceptionRecord on Windows, | |
53 // siginfo_t on Solaris/Linux | |
54 void * _context; // ContextRecord on Windows, | |
55 // ucontext_t on Solaris/Linux | |
56 | |
57 // additional info for VM internal errors | |
58 const char * _filename; | |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
513
diff
changeset
|
59 int _lineno; |
0 | 60 |
61 // used by fatal error handler | |
62 int _current_step; | |
63 const char * _current_step_info; | |
64 int _verbose; | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
65 // First error, and its thread id. We must be able to handle native thread, |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
66 // so use thread id instead of Thread* to identify thread. |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
67 static VMError* volatile first_error; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
68 static volatile jlong first_error_tid; |
0 | 69 |
70 // used by reporting about OOM | |
71 size_t _size; | |
72 | |
73 // set signal handlers on Solaris/Linux or the default exception filter | |
74 // on Windows, to handle recursive crashes. | |
75 void reset_signal_handlers(); | |
76 | |
77 // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string | |
78 void show_message_box(char* buf, int buflen); | |
79 | |
80 // generate an error report | |
81 void report(outputStream* st); | |
82 | |
1384 | 83 // generate a stack trace |
84 static void print_stack_trace(outputStream* st, JavaThread* jt, | |
85 char* buf, int buflen, bool verbose = false); | |
86 | |
0 | 87 // accessor |
1490
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
88 const char* message() const { return _message; } |
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
89 const char* detail_msg() const { return _detail_msg; } |
2095
36c186bcc085
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
1972
diff
changeset
|
90 bool should_report_bug(unsigned int id) { return id != oom_error; } |
0 | 91 |
92 public: | |
93 // Constructor for crashes | |
2095
36c186bcc085
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
1972
diff
changeset
|
94 VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, |
36c186bcc085
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
1972
diff
changeset
|
95 void* context); |
0 | 96 // Constructor for VM internal errors |
1490
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
97 VMError(Thread* thread, const char* filename, int lineno, |
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
98 const char* message, const char * detail_msg); |
0 | 99 |
1490
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
100 // Constructor for VM OOM errors |
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
101 VMError(Thread* thread, const char* filename, int lineno, size_t size, |
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1384
diff
changeset
|
102 const char* message); |
0 | 103 // Constructor for non-fatal errors |
104 VMError(const char* message); | |
105 | |
106 // return a string to describe the error | |
107 char *error_string(char* buf, int buflen); | |
108 | |
109 // main error reporting function | |
110 void report_and_die(); | |
111 | |
112 // reporting OutOfMemoryError | |
113 void report_java_out_of_memory(); | |
114 | |
115 // returns original flags for signal, if it was resetted, or -1 if | |
116 // signal was not changed by error reporter | |
117 static int get_resetted_sigflags(int sig); | |
118 | |
119 // returns original handler for signal, if it was resetted, or NULL if | |
120 // signal was not changed by error reporter | |
121 static address get_resetted_sighandler(int sig); | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
122 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
123 // check to see if fatal error reporting is in progress |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
124 static bool fatal_error_in_progress() { return first_error != NULL; } |
0 | 125 }; |
1972 | 126 |
127 #endif // SHARE_VM_UTILITIES_VMERROR_HPP |