author | goetz |
Wed, 20 Sep 2017 15:12:11 +0200 | |
changeset 47666 | 19219ec3f176 |
parent 47634 | 6a0c42c40cd1 |
child 47687 | fb290fd1f9d4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5403
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5403
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5403
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
25351
diff
changeset
|
26 |
#include "code/codeCache.hpp" |
7397 | 27 |
#include "compiler/compileBroker.hpp" |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
28 |
#include "compiler/disassembler.hpp" |
30764 | 29 |
#include "gc/shared/collectedHeap.hpp" |
37994
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
30 |
#include "logging/logConfiguration.hpp" |
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
31 |
#include "prims/jvm.h" |
12095 | 32 |
#include "prims/whitebox.hpp" |
7397 | 33 |
#include "runtime/arguments.hpp" |
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
39626
diff
changeset
|
34 |
#include "runtime/atomic.hpp" |
7397 | 35 |
#include "runtime/frame.inline.hpp" |
36 |
#include "runtime/init.hpp" |
|
37 |
#include "runtime/os.hpp" |
|
24351
61b33cc6d3cf
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
23204
diff
changeset
|
38 |
#include "runtime/thread.inline.hpp" |
7397 | 39 |
#include "runtime/vmThread.hpp" |
40 |
#include "runtime/vm_operations.hpp" |
|
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
41 |
#include "runtime/vm_version.hpp" |
13195 | 42 |
#include "services/memTracker.hpp" |
39274
940f0e8e9ec2
8158033: Notify_tracing() misplaced for intended purpose
mgronlun
parents:
38215
diff
changeset
|
43 |
#include "trace/traceMacros.hpp" |
7397 | 44 |
#include "utilities/debug.hpp" |
7447
32c42d627f41
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
7397
diff
changeset
|
45 |
#include "utilities/decoder.hpp" |
7397 | 46 |
#include "utilities/defaultStream.hpp" |
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
47 |
#include "utilities/errorReporter.hpp" |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
48 |
#include "utilities/events.hpp" |
7397 | 49 |
#include "utilities/vmError.hpp" |
1 | 50 |
|
46589 | 51 |
#ifndef PRODUCT |
52 |
#include <signal.h> |
|
53 |
#endif // PRODUCT |
|
54 |
||
55 |
bool VMError::_error_reported = false; |
|
56 |
||
57 |
// call this when the VM is dying--it might loosen some asserts |
|
58 |
bool VMError::is_error_reported() { return _error_reported; } |
|
59 |
||
60 |
// returns an address which is guaranteed to generate a SIGSEGV on read, |
|
61 |
// for test purposes, which is not NULL and contains bits in every word |
|
62 |
void* VMError::get_segfault_address() { |
|
63 |
return (void*) |
|
64 |
#ifdef _LP64 |
|
65 |
0xABC0000000000ABCULL; |
|
66 |
#else |
|
67 |
0x00000ABC; |
|
68 |
#endif |
|
69 |
} |
|
70 |
||
1 | 71 |
// List of environment variables that should be reported in error log file. |
72 |
const char *env_list[] = { |
|
73 |
// All platforms |
|
74 |
"JAVA_HOME", "JRE_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH", |
|
75 |
"JAVA_COMPILER", "PATH", "USERNAME", |
|
76 |
||
10565 | 77 |
// Env variables that are defined on Solaris/Linux/BSD |
1 | 78 |
"LD_LIBRARY_PATH", "LD_PRELOAD", "SHELL", "DISPLAY", |
79 |
"HOSTTYPE", "OSTYPE", "ARCH", "MACHTYPE", |
|
80 |
||
81 |
// defined on Linux |
|
82 |
"LD_ASSUME_KERNEL", "_JAVA_SR_SIGNUM", |
|
83 |
||
10565 | 84 |
// defined on Darwin |
85 |
"DYLD_LIBRARY_PATH", "DYLD_FALLBACK_LIBRARY_PATH", |
|
86 |
"DYLD_FRAMEWORK_PATH", "DYLD_FALLBACK_FRAMEWORK_PATH", |
|
87 |
"DYLD_INSERT_LIBRARIES", |
|
88 |
||
1 | 89 |
// defined on Windows |
90 |
"OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", |
|
91 |
||
92 |
(const char *)0 |
|
93 |
}; |
|
94 |
||
95 |
// A simple parser for -XX:OnError, usage: |
|
96 |
// ptr = OnError; |
|
97 |
// while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr) != NULL) |
|
98 |
// ... ... |
|
99 |
static char* next_OnError_command(char* buf, int buflen, const char** ptr) { |
|
100 |
if (ptr == NULL || *ptr == NULL) return NULL; |
|
101 |
||
102 |
const char* cmd = *ptr; |
|
103 |
||
104 |
// skip leading blanks or ';' |
|
105 |
while (*cmd == ' ' || *cmd == ';') cmd++; |
|
106 |
||
107 |
if (*cmd == '\0') return NULL; |
|
108 |
||
109 |
const char * cmdend = cmd; |
|
110 |
while (*cmdend != '\0' && *cmdend != ';') cmdend++; |
|
111 |
||
112 |
Arguments::copy_expand_pid(cmd, cmdend - cmd, buf, buflen); |
|
113 |
||
114 |
*ptr = (*cmdend == '\0' ? cmdend : cmdend + 1); |
|
115 |
return buf; |
|
116 |
} |
|
117 |
||
118 |
static void print_bug_submit_message(outputStream *out, Thread *thread) { |
|
119 |
if (out == NULL) return; |
|
120 |
out->print_raw_cr("# If you would like to submit a bug report, please visit:"); |
|
121 |
out->print_raw ("# "); |
|
122 |
out->print_raw_cr(Arguments::java_vendor_url_bug()); |
|
123 |
// If the crash is in native code, encourage user to submit a bug to the |
|
124 |
// provider of that code. |
|
229
4fddba548751
6549844: Wording problems in "An unexpected error ..."
coleenp
parents:
1
diff
changeset
|
125 |
if (thread && thread->is_Java_thread() && |
4fddba548751
6549844: Wording problems in "An unexpected error ..."
coleenp
parents:
1
diff
changeset
|
126 |
!thread->is_hidden_from_external_view()) { |
1 | 127 |
JavaThread* jt = (JavaThread*)thread; |
128 |
if (jt->thread_state() == _thread_in_native) { |
|
129 |
out->print_cr("# The crash happened outside the Java Virtual Machine in native code.\n# See problematic frame for where to report the bug."); |
|
130 |
} |
|
131 |
} |
|
132 |
out->print_raw_cr("#"); |
|
133 |
} |
|
134 |
||
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
135 |
bool VMError::coredump_status; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
136 |
char VMError::coredump_message[O_BUFLEN]; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
137 |
|
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
138 |
void VMError::record_coredump_status(const char* message, bool status) { |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
139 |
coredump_status = status; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
140 |
strncpy(coredump_message, message, sizeof(coredump_message)); |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
141 |
coredump_message[sizeof(coredump_message)-1] = 0; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
142 |
} |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
143 |
|
1 | 144 |
// Return a string to describe the error |
145 |
char* VMError::error_string(char* buf, int buflen) { |
|
146 |
char signame_buf[64]; |
|
147 |
const char *signame = os::exception_name(_id, signame_buf, sizeof(signame_buf)); |
|
148 |
||
149 |
if (signame) { |
|
150 |
jio_snprintf(buf, buflen, |
|
32583
e95e2cfc9cf5
8133561: linux thread id should be reported in decimal in the error reports now
coleenp
parents:
31963
diff
changeset
|
151 |
"%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT, |
1 | 152 |
signame, _id, _pc, |
153 |
os::current_process_id(), os::current_thread_id()); |
|
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
154 |
} else if (_filename != NULL && _lineno > 0) { |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
155 |
// skip directory names |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
156 |
char separator = os::file_separator()[0]; |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
157 |
const char *p = strrchr(_filename, separator); |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
158 |
int n = jio_snprintf(buf, buflen, |
32583
e95e2cfc9cf5
8133561: linux thread id should be reported in decimal in the error reports now
coleenp
parents:
31963
diff
changeset
|
159 |
"Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT, |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
160 |
p ? p + 1 : _filename, _lineno, |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
161 |
os::current_process_id(), os::current_thread_id()); |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
162 |
if (n >= 0 && n < buflen && _message) { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
163 |
if (strlen(_detail_msg) > 0) { |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
164 |
jio_snprintf(buf + n, buflen - n, "%s%s: %s", |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
165 |
os::line_separator(), _message, _detail_msg); |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
166 |
} else { |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
167 |
jio_snprintf(buf + n, buflen - n, "%sError: %s", |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
168 |
os::line_separator(), _message); |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
169 |
} |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
170 |
} |
1 | 171 |
} else { |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
172 |
jio_snprintf(buf, buflen, |
32583
e95e2cfc9cf5
8133561: linux thread id should be reported in decimal in the error reports now
coleenp
parents:
31963
diff
changeset
|
173 |
"Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT, |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
174 |
_id, os::current_process_id(), os::current_thread_id()); |
1 | 175 |
} |
176 |
||
177 |
return buf; |
|
178 |
} |
|
179 |
||
5340 | 180 |
void VMError::print_stack_trace(outputStream* st, JavaThread* jt, |
181 |
char* buf, int buflen, bool verbose) { |
|
182 |
#ifdef ZERO |
|
183 |
if (jt->zero_stack()->sp() && jt->top_zero_frame()) { |
|
184 |
// StackFrameStream uses the frame anchor, which may not have |
|
185 |
// been set up. This can be done at any time in Zero, however, |
|
186 |
// so if it hasn't been set up then we just set it up now and |
|
187 |
// clear it again when we're done. |
|
188 |
bool has_last_Java_frame = jt->has_last_Java_frame(); |
|
189 |
if (!has_last_Java_frame) |
|
190 |
jt->set_last_Java_frame(); |
|
191 |
st->print("Java frames:"); |
|
192 |
||
193 |
// If the top frame is a Shark frame and the frame anchor isn't |
|
194 |
// set up then it's possible that the information in the frame |
|
195 |
// is garbage: it could be from a previous decache, or it could |
|
196 |
// simply have never been written. So we print a warning... |
|
197 |
StackFrameStream sfs(jt); |
|
198 |
if (!has_last_Java_frame && !sfs.is_done()) { |
|
199 |
if (sfs.current()->zeroframe()->is_shark_frame()) { |
|
200 |
st->print(" (TOP FRAME MAY BE JUNK)"); |
|
201 |
} |
|
202 |
} |
|
203 |
st->cr(); |
|
204 |
||
205 |
// Print the frames |
|
206 |
for(int i = 0; !sfs.is_done(); sfs.next(), i++) { |
|
207 |
sfs.current()->zero_print_on_error(i, st, buf, buflen); |
|
208 |
st->cr(); |
|
209 |
} |
|
210 |
||
211 |
// Reset the frame anchor if necessary |
|
212 |
if (!has_last_Java_frame) |
|
213 |
jt->reset_last_Java_frame(); |
|
214 |
} |
|
215 |
#else |
|
216 |
if (jt->has_last_Java_frame()) { |
|
217 |
st->print_cr("Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)"); |
|
218 |
for(StackFrameStream sfs(jt); !sfs.is_done(); sfs.next()) { |
|
219 |
sfs.current()->print_on_error(st, buf, buflen, verbose); |
|
220 |
st->cr(); |
|
221 |
} |
|
222 |
} |
|
223 |
#endif // ZERO |
|
224 |
} |
|
1 | 225 |
|
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
226 |
void VMError::print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size) { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
227 |
|
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
228 |
// see if it's a valid frame |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
229 |
if (fr.pc()) { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
230 |
st->print_cr("Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)"); |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
231 |
|
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
232 |
int count = 0; |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
233 |
while (count++ < StackPrintLimit) { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
234 |
fr.print_on_error(st, buf, buf_size); |
47666 | 235 |
if (fr.pc()) { // print source file and line, if available |
236 |
char buf[128]; |
|
237 |
int line_no; |
|
238 |
if (Decoder::get_source_info(fr.pc(), buf, sizeof(buf), &line_no)) { |
|
239 |
st->print(" (%s:%d)", buf, line_no); |
|
240 |
} |
|
241 |
} |
|
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
242 |
st->cr(); |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
243 |
// Compiled code may use EBP register on x86 so it looks like |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
244 |
// non-walkable C frame. Use frame.sender() for java frames. |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
245 |
if (t && t->is_Java_thread()) { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
246 |
// Catch very first native frame by using stack address. |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
247 |
// For JavaThread stack_base and stack_size should be set. |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
248 |
if (!t->on_local_stack((address)(fr.real_fp() + 1))) { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
249 |
break; |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
250 |
} |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
251 |
if (fr.is_java_frame() || fr.is_native_frame() || fr.is_runtime_frame()) { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
252 |
RegisterMap map((JavaThread*)t, false); // No update |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
253 |
fr = fr.sender(&map); |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
254 |
} else { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
255 |
fr = os::get_sender_for_C_frame(&fr); |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
256 |
} |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
257 |
} else { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
258 |
// is_first_C_frame() does only simple checks for frame pointer, |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
259 |
// it will pass if java compiled code has a pointer in EBP. |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
260 |
if (os::is_first_C_frame(&fr)) break; |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
261 |
fr = os::get_sender_for_C_frame(&fr); |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
262 |
} |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
263 |
} |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
264 |
|
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
265 |
if (count > StackPrintLimit) { |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
266 |
st->print_cr("...<more frames>..."); |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
267 |
} |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
268 |
|
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
269 |
st->cr(); |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
270 |
} |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
271 |
} |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46501
diff
changeset
|
272 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
273 |
static void print_oom_reasons(outputStream* st) { |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
274 |
st->print_cr("# Possible reasons:"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
275 |
st->print_cr("# The system is out of physical RAM or swap space"); |
39626
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
276 |
if (UseCompressedOops) { |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
277 |
st->print_cr("# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
278 |
} |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
279 |
if (LogBytesPerWord == 2) { |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
280 |
st->print_cr("# In 32 bit mode, the process size limit was hit"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
281 |
} |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
282 |
st->print_cr("# Possible solutions:"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
283 |
st->print_cr("# Reduce memory load on the system"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
284 |
st->print_cr("# Increase physical memory or swap space"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
285 |
st->print_cr("# Check if swap backing store is full"); |
39626
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
286 |
if (LogBytesPerWord == 2) { |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
287 |
st->print_cr("# Use 64 bit Java on a 64 bit OS"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
288 |
} |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
289 |
st->print_cr("# Decrease Java heap size (-Xmx/-Xms)"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
290 |
st->print_cr("# Decrease number of Java threads"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
291 |
st->print_cr("# Decrease Java thread stack sizes (-Xss)"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
292 |
st->print_cr("# Set larger code cache with -XX:ReservedCodeCacheSize="); |
39626
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
293 |
if (UseCompressedOops) { |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
294 |
switch (Universe::narrow_oop_mode()) { |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
295 |
case Universe::UnscaledNarrowOop: |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
296 |
st->print_cr("# JVM is running with Unscaled Compressed Oops mode in which the Java heap is"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
297 |
st->print_cr("# placed in the first 4GB address space. The Java Heap base address is the"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
298 |
st->print_cr("# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
299 |
st->print_cr("# to set the Java Heap base and to place the Java Heap above 4GB virtual address."); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
300 |
break; |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
301 |
case Universe::ZeroBasedNarrowOop: |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
302 |
st->print_cr("# JVM is running with Zero Based Compressed Oops mode in which the Java heap is"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
303 |
st->print_cr("# placed in the first 32GB address space. The Java Heap base address is the"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
304 |
st->print_cr("# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress"); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
305 |
st->print_cr("# to set the Java Heap base and to place the Java Heap above 32GB virtual address."); |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
306 |
break; |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46589
diff
changeset
|
307 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46589
diff
changeset
|
308 |
break; |
39626
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
309 |
} |
f611156cf276
8064814: Print more helpful error message when getting OOM due to low Java Heap base when running with CompressedOops
poonam
parents:
39401
diff
changeset
|
310 |
} |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
311 |
st->print_cr("# This output file may be truncated or incomplete."); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
312 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
313 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
314 |
static const char* gc_mode() { |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
315 |
if (UseG1GC) return "g1 gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
316 |
if (UseParallelGC) return "parallel gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
317 |
if (UseConcMarkSweepGC) return "concurrent mark sweep gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
318 |
if (UseSerialGC) return "serial gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
319 |
return "ERROR in GC mode"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
320 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
321 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
322 |
static void report_vm_version(outputStream* st, char* buf, int buflen) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
323 |
// VM version |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
324 |
st->print_cr("#"); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
325 |
JDK_Version::current().to_string(buf, buflen); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
326 |
const char* runtime_name = JDK_Version::runtime_name() != NULL ? |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
327 |
JDK_Version::runtime_name() : ""; |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
328 |
const char* runtime_version = JDK_Version::runtime_version() != NULL ? |
35453
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
329 |
JDK_Version::runtime_version() : ""; |
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
330 |
const char* jdk_debug_level = Abstract_VM_Version::printable_jdk_debug_level() != NULL ? |
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
331 |
Abstract_VM_Version::printable_jdk_debug_level() : ""; |
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
332 |
|
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
333 |
st->print_cr("# JRE version: %s (%s) (%sbuild %s)", runtime_name, buf, |
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
334 |
jdk_debug_level, runtime_version); |
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
335 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
336 |
// This is the long version with some default settings added |
35453
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
337 |
st->print_cr("# Java VM: %s (%s%s, %s%s%s%s%s, %s, %s)", |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
338 |
Abstract_VM_Version::vm_name(), |
35453
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
339 |
jdk_debug_level, |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
340 |
Abstract_VM_Version::vm_release(), |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
341 |
Abstract_VM_Version::vm_info_string(), |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
342 |
TieredCompilation ? ", tiered" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
343 |
#if INCLUDE_JVMCI |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
344 |
EnableJVMCI ? ", jvmci" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
345 |
UseJVMCICompiler ? ", jvmci compiler" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
346 |
#else |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
347 |
"", "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
348 |
#endif |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
349 |
UseCompressedOops ? ", compressed oops" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
350 |
gc_mode(), |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
351 |
Abstract_VM_Version::vm_platform_string() |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
352 |
); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
353 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
354 |
|
1 | 355 |
// This is the main function to report a fatal error. Only one thread can |
356 |
// call this function, so we don't need to worry about MT-safety. But it's |
|
357 |
// possible that the error handler itself may crash or die on an internal |
|
358 |
// error, for example, when the stack/heap is badly damaged. We must be |
|
359 |
// able to handle recursive errors that happen inside error handler. |
|
360 |
// |
|
361 |
// Error reporting is done in several steps. If a crash or internal error |
|
362 |
// occurred when reporting an error, the nested signal/exception handler |
|
363 |
// can skip steps that are already (or partially) done. Error reporting will |
|
364 |
// continue from the next step. This allows us to retrieve and print |
|
365 |
// information that may be unsafe to get after a fatal error. If it happens, |
|
366 |
// you may find nested report_and_die() frames when you look at the stack |
|
367 |
// in a debugger. |
|
368 |
// |
|
369 |
// In general, a hang in error handler is much worse than a crash or internal |
|
370 |
// error, as it's harder to recover from a hang. Deadlock can happen if we |
|
371 |
// try to grab a lock that is already owned by current thread, or if the |
|
372 |
// owner is blocked forever (e.g. in os::infinite_sleep()). If possible, the |
|
373 |
// error handler and all the functions it called should avoid grabbing any |
|
374 |
// lock. An important thing to notice is that memory allocation needs a lock. |
|
375 |
// |
|
376 |
// We should avoid using large stack allocated buffers. Many errors happen |
|
377 |
// when stack space is already low. Making things even worse is that there |
|
378 |
// could be nested report_and_die() calls on stack (see above). Only one |
|
379 |
// thread can report error, so large buffers are statically allocated in data |
|
380 |
// segment. |
|
381 |
||
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
382 |
int VMError::_current_step; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
383 |
const char* VMError::_current_step_info; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
384 |
|
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
385 |
volatile jlong VMError::_reporting_start_time = -1; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
386 |
volatile bool VMError::_reporting_did_timeout = false; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
387 |
volatile jlong VMError::_step_start_time = -1; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
388 |
volatile bool VMError::_step_did_timeout = false; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
389 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
390 |
// Helper, return current timestamp for timeout handling. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
391 |
jlong VMError::get_current_timestamp() { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
392 |
return os::javaTimeNanos(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
393 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
394 |
// Factor to translate the timestamp to seconds. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
395 |
#define TIMESTAMP_TO_SECONDS_FACTOR (1000 * 1000 * 1000) |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
396 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
397 |
void VMError::record_reporting_start_time() { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
398 |
const jlong now = get_current_timestamp(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
399 |
Atomic::store(now, &_reporting_start_time); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
400 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
401 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
402 |
jlong VMError::get_reporting_start_time() { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
403 |
return Atomic::load(&_reporting_start_time); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
404 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
405 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
406 |
void VMError::record_step_start_time() { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
407 |
const jlong now = get_current_timestamp(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
408 |
Atomic::store(now, &_step_start_time); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
409 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
410 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
411 |
jlong VMError::get_step_start_time() { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
412 |
return Atomic::load(&_step_start_time); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
413 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
414 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
415 |
void VMError::report(outputStream* st, bool _verbose) { |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
416 |
|
38215 | 417 |
# define BEGIN if (_current_step == 0) { _current_step = __LINE__; |
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
418 |
# define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s; \ |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
419 |
record_step_start_time(); _step_did_timeout = false; |
1 | 420 |
# define END } |
421 |
||
422 |
// don't allocate large buffer on stack |
|
423 |
static char buf[O_BUFLEN]; |
|
424 |
||
425 |
BEGIN |
|
426 |
||
38215 | 427 |
STEP("printing fatal error message") |
1 | 428 |
|
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
429 |
st->print_cr("#"); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
430 |
if (should_report_bug(_id)) { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
431 |
st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
432 |
} else { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
433 |
st->print_cr("# There is insufficient memory for the Java " |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
434 |
"Runtime Environment to continue."); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
435 |
} |
1 | 436 |
|
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
437 |
#ifndef PRODUCT |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
438 |
// Error handler self tests |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
439 |
|
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
440 |
// test secondary error handling. Test it twice, to test that resetting |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
441 |
// error handler after a secondary crash works. |
38215 | 442 |
STEP("test secondary crash 1") |
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
443 |
if (_verbose && TestCrashInErrorHandler != 0) { |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
444 |
st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", |
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
445 |
TestCrashInErrorHandler); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
446 |
controlled_crash(TestCrashInErrorHandler); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
447 |
} |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
448 |
|
38215 | 449 |
STEP("test secondary crash 2") |
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
450 |
if (_verbose && TestCrashInErrorHandler != 0) { |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
451 |
st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", |
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
452 |
TestCrashInErrorHandler); |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
453 |
controlled_crash(TestCrashInErrorHandler); |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
454 |
} |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
455 |
|
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
456 |
// TestUnresponsiveErrorHandler: We want to test both step timeouts and global timeout. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
457 |
// Step to global timeout ratio is 4:1, so in order to be absolutely sure we hit the |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
458 |
// global timeout, let's execute the timeout step five times. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
459 |
// See corresponding test in test/runtime/ErrorHandling/TimeoutInErrorHandlingTest.java |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
460 |
#define TIMEOUT_TEST_STEP STEP("test unresponsive error reporting step") \ |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
461 |
if (_verbose && TestUnresponsiveErrorHandler) { os::infinite_sleep(); } |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
462 |
TIMEOUT_TEST_STEP |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
463 |
TIMEOUT_TEST_STEP |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
464 |
TIMEOUT_TEST_STEP |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
465 |
TIMEOUT_TEST_STEP |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
466 |
TIMEOUT_TEST_STEP |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
467 |
|
38215 | 468 |
STEP("test safefetch in error handler") |
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
469 |
// test whether it is safe to use SafeFetch32 in Crash Handler. Test twice |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
470 |
// to test that resetting the signal handler works correctly. |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
471 |
if (_verbose && TestSafeFetchInErrorHandler) { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
472 |
st->print_cr("Will test SafeFetch..."); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
473 |
if (CanUseSafeFetch32()) { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
474 |
int* const invalid_pointer = (int*) get_segfault_address(); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
475 |
const int x = 0x76543210; |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
476 |
int i1 = SafeFetch32(invalid_pointer, x); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
477 |
int i2 = SafeFetch32(invalid_pointer, x); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
478 |
if (i1 == x && i2 == x) { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
479 |
st->print_cr("SafeFetch OK."); // Correctly deflected and returned default pattern |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
480 |
} else { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
481 |
st->print_cr("??"); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
482 |
} |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
483 |
} else { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
484 |
st->print_cr("not possible; skipped."); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
485 |
} |
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
486 |
} |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
487 |
#endif // PRODUCT |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
488 |
|
38215 | 489 |
STEP("printing type of error") |
1 | 490 |
|
491 |
switch(_id) { |
|
17087
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
492 |
case OOM_MALLOC_ERROR: |
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
493 |
case OOM_MMAP_ERROR: |
1 | 494 |
if (_size) { |
17087
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
495 |
st->print("# Native memory allocation "); |
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
496 |
st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : |
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
497 |
"(mmap) failed to map "); |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
498 |
jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24351
diff
changeset
|
499 |
st->print("%s", buf); |
1 | 500 |
st->print(" bytes"); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
501 |
if (strlen(_detail_msg) > 0) { |
1 | 502 |
st->print(" for "); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
503 |
st->print("%s", _detail_msg); |
1 | 504 |
} |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
505 |
st->cr(); |
1 | 506 |
} else { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
507 |
if (strlen(_detail_msg) > 0) { |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
508 |
st->print("# "); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
509 |
st->print_cr("%s", _detail_msg); |
31615 | 510 |
} |
1 | 511 |
} |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
512 |
// In error file give some solutions |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
513 |
if (_verbose) { |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
514 |
print_oom_reasons(st); |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
515 |
} else { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
516 |
return; // that's enough for the screen |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
517 |
} |
1 | 518 |
break; |
17087
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
519 |
case INTERNAL_ERROR: |
1 | 520 |
default: |
521 |
break; |
|
522 |
} |
|
523 |
||
38215 | 524 |
STEP("printing exception/signal name") |
1 | 525 |
|
526 |
st->print_cr("#"); |
|
527 |
st->print("# "); |
|
528 |
// Is it an OS exception/signal? |
|
529 |
if (os::exception_name(_id, buf, sizeof(buf))) { |
|
530 |
st->print("%s", buf); |
|
531 |
st->print(" (0x%x)", _id); // signal number |
|
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
532 |
st->print(" at pc=" PTR_FORMAT, p2i(_pc)); |
1 | 533 |
} else { |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
534 |
if (should_report_bug(_id)) { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
535 |
st->print("Internal Error"); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
536 |
} else { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
537 |
st->print("Out of Memory Error"); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
538 |
} |
1 | 539 |
if (_filename != NULL && _lineno > 0) { |
540 |
#ifdef PRODUCT |
|
541 |
// In product mode chop off pathname? |
|
542 |
char separator = os::file_separator()[0]; |
|
543 |
const char *p = strrchr(_filename, separator); |
|
544 |
const char *file = p ? p+1 : _filename; |
|
545 |
#else |
|
546 |
const char *file = _filename; |
|
547 |
#endif |
|
30281 | 548 |
st->print(" (%s:%d)", file, _lineno); |
1 | 549 |
} else { |
550 |
st->print(" (0x%x)", _id); |
|
551 |
} |
|
552 |
} |
|
553 |
||
38215 | 554 |
STEP("printing current thread and pid") |
1 | 555 |
|
556 |
// process id, thread id |
|
557 |
st->print(", pid=%d", os::current_process_id()); |
|
32583
e95e2cfc9cf5
8133561: linux thread id should be reported in decimal in the error reports now
coleenp
parents:
31963
diff
changeset
|
558 |
st->print(", tid=" UINTX_FORMAT, os::current_thread_id()); |
1 | 559 |
st->cr(); |
560 |
||
38215 | 561 |
STEP("printing error message") |
1 | 562 |
|
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
563 |
if (should_report_bug(_id)) { // already printed the message. |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
564 |
// error message |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
565 |
if (strlen(_detail_msg) > 0) { |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
566 |
st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
567 |
} else if (_message) { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
568 |
st->print_cr("# Error: %s", _message); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
569 |
} |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
570 |
} |
1 | 571 |
|
38215 | 572 |
STEP("printing Java version string") |
1 | 573 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
574 |
report_vm_version(st, buf, sizeof(buf)); |
1 | 575 |
|
38215 | 576 |
STEP("printing problematic frame") |
1 | 577 |
|
578 |
// Print current frame if we have a context (i.e. it's a crash) |
|
579 |
if (_context) { |
|
580 |
st->print_cr("# Problematic frame:"); |
|
581 |
st->print("# "); |
|
582 |
frame fr = os::fetch_frame_from_context(_context); |
|
583 |
fr.print_on_error(st, buf, sizeof(buf)); |
|
584 |
st->cr(); |
|
585 |
st->print_cr("#"); |
|
586 |
} |
|
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
587 |
|
38215 | 588 |
STEP("printing core file information") |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
589 |
st->print("# "); |
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
590 |
if (CreateCoredumpOnCrash) { |
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
591 |
if (coredump_status) { |
30622
648d51c142bd
8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
30281
diff
changeset
|
592 |
st->print("Core dump will be written. Default location: %s", coredump_message); |
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
593 |
} else { |
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
594 |
st->print("No core dump will be written. %s", coredump_message); |
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
595 |
} |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
596 |
} else { |
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
597 |
st->print("CreateCoredumpOnCrash turned off, no core file dumped"); |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
598 |
} |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24351
diff
changeset
|
599 |
st->cr(); |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
600 |
st->print_cr("#"); |
1 | 601 |
|
38215 | 602 |
STEP("printing bug submit message") |
1 | 603 |
|
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
604 |
if (should_report_bug(_id) && _verbose) { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
605 |
print_bug_submit_message(st, _thread); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
606 |
} |
1 | 607 |
|
38215 | 608 |
STEP("printing summary") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
609 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
610 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
611 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
612 |
st->print_cr("--------------- S U M M A R Y ------------"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
613 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
614 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
615 |
|
38215 | 616 |
STEP("printing VM option summary") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
617 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
618 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
619 |
// VM options |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
620 |
Arguments::print_summary_on(st); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
621 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
622 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
623 |
|
38215 | 624 |
STEP("printing summary machine and OS info") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
625 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
626 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
627 |
os::print_summary_info(st, buf, sizeof(buf)); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
628 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
629 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
630 |
|
38215 | 631 |
STEP("printing date and time") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
632 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
633 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
634 |
os::print_date_and_time(st, buf, sizeof(buf)); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
635 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
636 |
|
38215 | 637 |
STEP("printing thread") |
1 | 638 |
|
639 |
if (_verbose) { |
|
640 |
st->cr(); |
|
641 |
st->print_cr("--------------- T H R E A D ---------------"); |
|
642 |
st->cr(); |
|
643 |
} |
|
644 |
||
38215 | 645 |
STEP("printing current thread") |
1 | 646 |
|
647 |
// current thread |
|
648 |
if (_verbose) { |
|
649 |
if (_thread) { |
|
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
650 |
st->print("Current thread (" PTR_FORMAT "): ", p2i(_thread)); |
1 | 651 |
_thread->print_on_error(st, buf, sizeof(buf)); |
652 |
st->cr(); |
|
653 |
} else { |
|
654 |
st->print_cr("Current thread is native thread"); |
|
655 |
} |
|
656 |
st->cr(); |
|
657 |
} |
|
658 |
||
38215 | 659 |
STEP("printing current compile task") |
1 | 660 |
|
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
661 |
if (_verbose && _thread && _thread->is_Compiler_thread()) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
662 |
CompilerThread* t = (CompilerThread*)_thread; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
663 |
if (t->task()) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
664 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
665 |
st->print_cr("Current CompileTask:"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
666 |
t->task()->print_line_on_error(st, buf, sizeof(buf)); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
667 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
668 |
} |
1 | 669 |
} |
670 |
||
671 |
||
38215 | 672 |
STEP("printing stack bounds") |
1 | 673 |
|
674 |
if (_verbose) { |
|
675 |
st->print("Stack: "); |
|
676 |
||
677 |
address stack_top; |
|
678 |
size_t stack_size; |
|
679 |
||
680 |
if (_thread) { |
|
681 |
stack_top = _thread->stack_base(); |
|
682 |
stack_size = _thread->stack_size(); |
|
683 |
} else { |
|
684 |
stack_top = os::current_stack_base(); |
|
685 |
stack_size = os::current_stack_size(); |
|
686 |
} |
|
687 |
||
688 |
address stack_bottom = stack_top - stack_size; |
|
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
689 |
st->print("[" PTR_FORMAT "," PTR_FORMAT "]", p2i(stack_bottom), p2i(stack_top)); |
1 | 690 |
|
691 |
frame fr = _context ? os::fetch_frame_from_context(_context) |
|
692 |
: os::current_frame(); |
|
693 |
||
694 |
if (fr.sp()) { |
|
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
695 |
st->print(", sp=" PTR_FORMAT, p2i(fr.sp())); |
6179
4846648c4b7b
6973308: Missing zero length check before repne scas in check_klass_subtype_slow_path()
kvn
parents:
5547
diff
changeset
|
696 |
size_t free_stack_size = pointer_delta(fr.sp(), stack_bottom, 1024); |
4846648c4b7b
6973308: Missing zero length check before repne scas in check_klass_subtype_slow_path()
kvn
parents:
5547
diff
changeset
|
697 |
st->print(", free space=" SIZE_FORMAT "k", free_stack_size); |
1 | 698 |
} |
699 |
||
700 |
st->cr(); |
|
701 |
} |
|
702 |
||
38215 | 703 |
STEP("printing native stack") |
1 | 704 |
|
26821
ce9f82507dc2
8058345: Refactor native stack printing from vmError.cpp to debug.cpp to make it available in gdb as well
simonis
parents:
25946
diff
changeset
|
705 |
if (_verbose) { |
19952
bc974e92f881
8022335: Native stack walk while generating hs_err does not work on Windows x64
iklam
parents:
19334
diff
changeset
|
706 |
if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) { |
bc974e92f881
8022335: Native stack walk while generating hs_err does not work on Windows x64
iklam
parents:
19334
diff
changeset
|
707 |
// We have printed the native stack in platform-specific code |
bc974e92f881
8022335: Native stack walk while generating hs_err does not work on Windows x64
iklam
parents:
19334
diff
changeset
|
708 |
// Windows/x64 needs special handling. |
bc974e92f881
8022335: Native stack walk while generating hs_err does not work on Windows x64
iklam
parents:
19334
diff
changeset
|
709 |
} else { |
1 | 710 |
frame fr = _context ? os::fetch_frame_from_context(_context) |
711 |
: os::current_frame(); |
|
712 |
||
26821
ce9f82507dc2
8058345: Refactor native stack printing from vmError.cpp to debug.cpp to make it available in gdb as well
simonis
parents:
25946
diff
changeset
|
713 |
print_native_stack(st, fr, _thread, buf, sizeof(buf)); |
1 | 714 |
} |
19952
bc974e92f881
8022335: Native stack walk while generating hs_err does not work on Windows x64
iklam
parents:
19334
diff
changeset
|
715 |
} |
1 | 716 |
|
38215 | 717 |
STEP("printing Java stack") |
1 | 718 |
|
719 |
if (_verbose && _thread && _thread->is_Java_thread()) { |
|
5340 | 720 |
print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf)); |
1 | 721 |
} |
722 |
||
38215 | 723 |
STEP("printing target Java thread stack") |
4489
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
724 |
|
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
725 |
// printing Java thread stack trace if it is involved in GC crash |
7108 | 726 |
if (_verbose && _thread && (_thread->is_Named_thread())) { |
4489
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
727 |
JavaThread* jt = ((NamedThread *)_thread)->processed_thread(); |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
728 |
if (jt != NULL) { |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
729 |
st->print_cr("JavaThread " PTR_FORMAT " (nid = %d) was being processed", p2i(jt), jt->osthread()->thread_id()); |
5340 | 730 |
print_stack_trace(st, jt, buf, sizeof(buf), true); |
4489
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
731 |
} |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
732 |
} |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
733 |
|
38215 | 734 |
STEP("printing siginfo") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
735 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
736 |
// signal no, signal code, address that caused the fault |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
737 |
if (_verbose && _siginfo) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
738 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
739 |
os::print_siginfo(st, _siginfo); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
740 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
741 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
742 |
|
38215 | 743 |
STEP("CDS archive access warning") |
35176
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
744 |
|
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
745 |
// Print an explicit hint if we crashed on access to the CDS archive. |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
746 |
if (_verbose && _siginfo) { |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
747 |
check_failing_cds_access(st, _siginfo); |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
748 |
st->cr(); |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
749 |
} |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
750 |
|
38215 | 751 |
STEP("printing register info") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
752 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
753 |
// decode register contents if possible |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
754 |
if (_verbose && _context && Universe::is_fully_initialized()) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
755 |
os::print_register_info(st, _context); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
756 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
757 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
758 |
|
38215 | 759 |
STEP("printing registers, top of stack, instructions near pc") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
760 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
761 |
// registers, top of stack, instructions near pc |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
762 |
if (_verbose && _context) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
763 |
os::print_context(st, _context); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
764 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
765 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
766 |
|
38215 | 767 |
STEP("printing code blob if possible") |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
768 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
769 |
if (_verbose && _context) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
770 |
CodeBlob* cb = CodeCache::find_blob(_pc); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
771 |
if (cb != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
772 |
if (Interpreter::contains(_pc)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
773 |
// The interpreter CodeBlob is very large so try to print the codelet instead. |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
774 |
InterpreterCodelet* codelet = Interpreter::codelet_containing(_pc); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
775 |
if (codelet != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
776 |
codelet->print_on(st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
777 |
Disassembler::decode(codelet->code_begin(), codelet->code_end(), st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
778 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
779 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
780 |
StubCodeDesc* desc = StubCodeDesc::desc_for(_pc); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
781 |
if (desc != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
782 |
desc->print_on(st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
783 |
Disassembler::decode(desc->begin(), desc->end(), st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
784 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
785 |
Disassembler::decode(cb, st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
786 |
st->cr(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
787 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
788 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
789 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
790 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
791 |
|
38215 | 792 |
STEP("printing VM operation") |
1 | 793 |
|
794 |
if (_verbose && _thread && _thread->is_VM_thread()) { |
|
795 |
VMThread* t = (VMThread*)_thread; |
|
796 |
VM_Operation* op = t->vm_operation(); |
|
797 |
if (op) { |
|
798 |
op->print_on_error(st); |
|
799 |
st->cr(); |
|
800 |
st->cr(); |
|
801 |
} |
|
802 |
} |
|
803 |
||
38215 | 804 |
STEP("printing process") |
1 | 805 |
|
806 |
if (_verbose) { |
|
807 |
st->cr(); |
|
808 |
st->print_cr("--------------- P R O C E S S ---------------"); |
|
809 |
st->cr(); |
|
810 |
} |
|
811 |
||
38215 | 812 |
STEP("printing all threads") |
1 | 813 |
|
814 |
// all threads |
|
815 |
if (_verbose && _thread) { |
|
816 |
Threads::print_on_error(st, _thread, buf, sizeof(buf)); |
|
817 |
st->cr(); |
|
818 |
} |
|
819 |
||
38215 | 820 |
STEP("printing VM state") |
1 | 821 |
|
822 |
if (_verbose) { |
|
823 |
// Safepoint state |
|
824 |
st->print("VM state:"); |
|
825 |
||
826 |
if (SafepointSynchronize::is_synchronizing()) st->print("synchronizing"); |
|
827 |
else if (SafepointSynchronize::is_at_safepoint()) st->print("at safepoint"); |
|
828 |
else st->print("not at safepoint"); |
|
829 |
||
830 |
// Also see if error occurred during initialization or shutdown |
|
831 |
if (!Universe::is_fully_initialized()) { |
|
832 |
st->print(" (not fully initialized)"); |
|
833 |
} else if (VM_Exit::vm_exited()) { |
|
834 |
st->print(" (shutting down)"); |
|
835 |
} else { |
|
836 |
st->print(" (normal execution)"); |
|
837 |
} |
|
838 |
st->cr(); |
|
839 |
st->cr(); |
|
840 |
} |
|
841 |
||
38215 | 842 |
STEP("printing owned locks on error") |
1 | 843 |
|
844 |
// mutexes/monitors that currently have an owner |
|
845 |
if (_verbose) { |
|
846 |
print_owned_locks_on_error(st); |
|
847 |
st->cr(); |
|
848 |
} |
|
849 |
||
38215 | 850 |
STEP("printing number of OutOfMemoryError and StackOverflow exceptions") |
31335
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
851 |
|
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
852 |
if (_verbose && Exceptions::has_exception_counts()) { |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
853 |
st->print_cr("OutOfMemory and StackOverflow Exception counts:"); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
854 |
Exceptions::print_exception_counts_on_error(st); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
855 |
st->cr(); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
856 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
857 |
|
38215 | 858 |
STEP("printing compressed oops mode") |
31335
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
859 |
|
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
860 |
if (_verbose && UseCompressedOops) { |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
861 |
Universe::print_compressed_oops_mode(st); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
862 |
if (UseCompressedClassPointers) { |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
863 |
Metaspace::print_compressed_class_space(st); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
864 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
865 |
st->cr(); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
866 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
867 |
|
38215 | 868 |
STEP("printing heap information") |
1 | 869 |
|
870 |
if (_verbose && Universe::is_fully_initialized()) { |
|
16685
41c34debcde0
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
15602
diff
changeset
|
871 |
Universe::heap()->print_on_error(st); |
12268 | 872 |
st->cr(); |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
873 |
st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page())); |
12268 | 874 |
st->cr(); |
1 | 875 |
} |
876 |
||
38215 | 877 |
STEP("printing code cache information") |
7108 | 878 |
|
879 |
if (_verbose && Universe::is_fully_initialized()) { |
|
880 |
// print code cache information before vm abort |
|
15201
f3d755b11424
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
14477
diff
changeset
|
881 |
CodeCache::print_summary(st); |
7108 | 882 |
st->cr(); |
883 |
} |
|
884 |
||
38215 | 885 |
STEP("printing ring buffers") |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
886 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
887 |
if (_verbose) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
888 |
Events::print_all(st); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
889 |
st->cr(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
890 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
891 |
|
38215 | 892 |
STEP("printing dynamic libraries") |
1 | 893 |
|
894 |
if (_verbose) { |
|
895 |
// dynamic libraries, or memory map |
|
896 |
os::print_dll_info(st); |
|
897 |
st->cr(); |
|
898 |
} |
|
899 |
||
47086
2b35673f6297
8186349: [windows] Centralize dbghelp handling code
stuefe
parents:
46630
diff
changeset
|
900 |
STEP("printing native decoder state") |
2b35673f6297
8186349: [windows] Centralize dbghelp handling code
stuefe
parents:
46630
diff
changeset
|
901 |
|
2b35673f6297
8186349: [windows] Centralize dbghelp handling code
stuefe
parents:
46630
diff
changeset
|
902 |
if (_verbose) { |
2b35673f6297
8186349: [windows] Centralize dbghelp handling code
stuefe
parents:
46630
diff
changeset
|
903 |
Decoder::print_state_on(st); |
2b35673f6297
8186349: [windows] Centralize dbghelp handling code
stuefe
parents:
46630
diff
changeset
|
904 |
st->cr(); |
2b35673f6297
8186349: [windows] Centralize dbghelp handling code
stuefe
parents:
46630
diff
changeset
|
905 |
} |
2b35673f6297
8186349: [windows] Centralize dbghelp handling code
stuefe
parents:
46630
diff
changeset
|
906 |
|
38215 | 907 |
STEP("printing VM options") |
1 | 908 |
|
909 |
if (_verbose) { |
|
910 |
// VM options |
|
911 |
Arguments::print_on(st); |
|
912 |
st->cr(); |
|
913 |
} |
|
914 |
||
38215 | 915 |
STEP("printing warning if internal testing API used") |
12095 | 916 |
|
917 |
if (WhiteBox::used()) { |
|
918 |
st->print_cr("Unsupported internal testing APIs have been used."); |
|
919 |
st->cr(); |
|
920 |
} |
|
921 |
||
38215 | 922 |
STEP("printing log configuration") |
37994
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
923 |
if (_verbose){ |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
924 |
st->print_cr("Logging:"); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
925 |
LogConfiguration::describe_current_configuration(st); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
926 |
st->cr(); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
927 |
} |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
928 |
|
38215 | 929 |
STEP("printing all environment variables") |
1 | 930 |
|
931 |
if (_verbose) { |
|
30125 | 932 |
os::print_environment_variables(st, env_list); |
1 | 933 |
st->cr(); |
934 |
} |
|
935 |
||
38215 | 936 |
STEP("printing signal handlers") |
1 | 937 |
|
938 |
if (_verbose) { |
|
939 |
os::print_signal_handlers(st, buf, sizeof(buf)); |
|
940 |
st->cr(); |
|
941 |
} |
|
942 |
||
38215 | 943 |
STEP("Native Memory Tracking") |
25946 | 944 |
if (_verbose) { |
27162
0a4a7276949b
8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
26821
diff
changeset
|
945 |
MemTracker::error_report(st); |
25946 | 946 |
} |
947 |
||
38215 | 948 |
STEP("printing system") |
1 | 949 |
|
950 |
if (_verbose) { |
|
951 |
st->cr(); |
|
952 |
st->print_cr("--------------- S Y S T E M ---------------"); |
|
953 |
st->cr(); |
|
954 |
} |
|
955 |
||
38215 | 956 |
STEP("printing OS information") |
1 | 957 |
|
958 |
if (_verbose) { |
|
959 |
os::print_os_info(st); |
|
960 |
st->cr(); |
|
961 |
} |
|
962 |
||
38215 | 963 |
STEP("printing CPU info") |
1 | 964 |
if (_verbose) { |
31356
55ee785c49c5
8085865: hs_err improvement: Printing /proc/cpuinfo makes too long hs_err files
coleenp
parents:
31335
diff
changeset
|
965 |
os::print_cpu_info(st, buf, sizeof(buf)); |
1 | 966 |
st->cr(); |
967 |
} |
|
968 |
||
38215 | 969 |
STEP("printing memory info") |
1 | 970 |
|
971 |
if (_verbose) { |
|
972 |
os::print_memory_info(st); |
|
973 |
st->cr(); |
|
974 |
} |
|
975 |
||
38215 | 976 |
STEP("printing internal vm info") |
1 | 977 |
|
978 |
if (_verbose) { |
|
979 |
st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); |
|
980 |
st->cr(); |
|
981 |
} |
|
982 |
||
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
983 |
// print a defined marker to show that error handling finished correctly. |
38215 | 984 |
STEP("printing end marker") |
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
985 |
|
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
986 |
if (_verbose) { |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
987 |
st->print_cr("END."); |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
988 |
} |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
989 |
|
1 | 990 |
END |
991 |
||
992 |
# undef BEGIN |
|
993 |
# undef STEP |
|
994 |
# undef END |
|
995 |
} |
|
996 |
||
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
997 |
// Report for the vm_info_cmd. This prints out the information above omitting |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
998 |
// crash and thread specific information. If output is added above, it should be added |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
999 |
// here also, if it is safe to call during a running process. |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1000 |
void VMError::print_vm_info(outputStream* st) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1001 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1002 |
char buf[O_BUFLEN]; |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1003 |
report_vm_version(st, buf, sizeof(buf)); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1004 |
|
38215 | 1005 |
// STEP("printing summary") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1006 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1007 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1008 |
st->print_cr("--------------- S U M M A R Y ------------"); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1009 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1010 |
|
38215 | 1011 |
// STEP("printing VM option summary") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1012 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1013 |
// VM options |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1014 |
Arguments::print_summary_on(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1015 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1016 |
|
38215 | 1017 |
// STEP("printing summary machine and OS info") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1018 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1019 |
os::print_summary_info(st, buf, sizeof(buf)); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1020 |
|
38215 | 1021 |
// STEP("printing date and time") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1022 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1023 |
os::print_date_and_time(st, buf, sizeof(buf)); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1024 |
|
38215 | 1025 |
// Skip: STEP("printing thread") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1026 |
|
38215 | 1027 |
// STEP("printing process") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1028 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1029 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1030 |
st->print_cr("--------------- P R O C E S S ---------------"); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1031 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1032 |
|
38215 | 1033 |
// STEP("printing number of OutOfMemoryError and StackOverflow exceptions") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1034 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1035 |
if (Exceptions::has_exception_counts()) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1036 |
st->print_cr("OutOfMemory and StackOverflow Exception counts:"); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1037 |
Exceptions::print_exception_counts_on_error(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1038 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1039 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1040 |
|
38215 | 1041 |
// STEP("printing compressed oops mode") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1042 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1043 |
if (UseCompressedOops) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1044 |
Universe::print_compressed_oops_mode(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1045 |
if (UseCompressedClassPointers) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1046 |
Metaspace::print_compressed_class_space(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1047 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1048 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1049 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1050 |
|
38215 | 1051 |
// STEP("printing heap information") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1052 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1053 |
if (Universe::is_fully_initialized()) { |
39401 | 1054 |
MutexLocker hl(Heap_lock); |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1055 |
Universe::heap()->print_on_error(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1056 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1057 |
st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page())); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1058 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1059 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1060 |
|
38215 | 1061 |
// STEP("printing code cache information") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1062 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1063 |
if (Universe::is_fully_initialized()) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1064 |
// print code cache information before vm abort |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1065 |
CodeCache::print_summary(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1066 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1067 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1068 |
|
38215 | 1069 |
// STEP("printing ring buffers") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1070 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1071 |
Events::print_all(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1072 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1073 |
|
38215 | 1074 |
// STEP("printing dynamic libraries") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1075 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1076 |
// dynamic libraries, or memory map |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1077 |
os::print_dll_info(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1078 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1079 |
|
38215 | 1080 |
// STEP("printing VM options") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1081 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1082 |
// VM options |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1083 |
Arguments::print_on(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1084 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1085 |
|
38215 | 1086 |
// STEP("printing warning if internal testing API used") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1087 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1088 |
if (WhiteBox::used()) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1089 |
st->print_cr("Unsupported internal testing APIs have been used."); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1090 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1091 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1092 |
|
38215 | 1093 |
// STEP("printing log configuration") |
37994
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
1094 |
st->print_cr("Logging:"); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
1095 |
LogConfiguration::describe(st); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
1096 |
st->cr(); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
1097 |
|
38215 | 1098 |
// STEP("printing all environment variables") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1099 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1100 |
os::print_environment_variables(st, env_list); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1101 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1102 |
|
38215 | 1103 |
// STEP("printing signal handlers") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1104 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1105 |
os::print_signal_handlers(st, buf, sizeof(buf)); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1106 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1107 |
|
38215 | 1108 |
// STEP("Native Memory Tracking") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1109 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1110 |
MemTracker::error_report(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1111 |
|
38215 | 1112 |
// STEP("printing system") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1113 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1114 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1115 |
st->print_cr("--------------- S Y S T E M ---------------"); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1116 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1117 |
|
38215 | 1118 |
// STEP("printing OS information") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1119 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1120 |
os::print_os_info(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1121 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1122 |
|
38215 | 1123 |
// STEP("printing CPU info") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1124 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1125 |
os::print_cpu_info(st, buf, sizeof(buf)); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1126 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1127 |
|
38215 | 1128 |
// STEP("printing memory info") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1129 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1130 |
os::print_memory_info(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1131 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1132 |
|
38215 | 1133 |
// STEP("printing internal vm info") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1134 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1135 |
st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1136 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1137 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1138 |
// print a defined marker to show that error handling finished correctly. |
38215 | 1139 |
// STEP("printing end marker") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1140 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1141 |
st->print_cr("END."); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1142 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1143 |
|
33131
a8ad9de9e5a4
8138832: CreateCoredumpOnCrash on linux ARM causes assert message to be repeated.
david
parents:
33105
diff
changeset
|
1144 |
volatile intptr_t VMError::first_error_tid = -1; |
1 | 1145 |
|
18487
270ef05ebce8
7060111: race condition in VMError::report_and_die()
fparain
parents:
17134
diff
changeset
|
1146 |
// An error could happen before tty is initialized or after it has been |
35869 | 1147 |
// destroyed. |
1148 |
// Please note: to prevent large stack allocations, the log- and |
|
1149 |
// output-stream use a global scratch buffer for format printing. |
|
1150 |
// (see VmError::report_and_die(). Access to those streams is synchronized |
|
1151 |
// in VmError::report_and_die() - there is only one reporting thread at |
|
1152 |
// any given time. |
|
18487
270ef05ebce8
7060111: race condition in VMError::report_and_die()
fparain
parents:
17134
diff
changeset
|
1153 |
fdStream VMError::out(defaultStream::output_fd()); |
270ef05ebce8
7060111: race condition in VMError::report_and_die()
fparain
parents:
17134
diff
changeset
|
1154 |
fdStream VMError::log; // error log used by VMError::report_and_die() |
270ef05ebce8
7060111: race condition in VMError::report_and_die()
fparain
parents:
17134
diff
changeset
|
1155 |
|
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1156 |
/** Expand a pattern into a buffer starting at pos and open a file using constructed path */ |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1157 |
static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1158 |
int fd = -1; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1159 |
if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { |
28513
9464a1b5c184
8050807: Better performing performance data handling
gthornbr
parents:
27471
diff
changeset
|
1160 |
// the O_EXCL flag will cause the open to fail if the file exists |
9464a1b5c184
8050807: Better performing performance data handling
gthornbr
parents:
27471
diff
changeset
|
1161 |
fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666); |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1162 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1163 |
return fd; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1164 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1165 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1166 |
/** |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1167 |
* Construct file name for a log file and return it's file descriptor. |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1168 |
* Name and location depends on pattern, default_pattern params and access |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1169 |
* permissions. |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1170 |
*/ |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1171 |
static int prepare_log_file(const char* pattern, const char* default_pattern, char* buf, size_t buflen) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1172 |
int fd = -1; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1173 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1174 |
// If possible, use specified pattern to construct log file name |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1175 |
if (pattern != NULL) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1176 |
fd = expand_and_open(pattern, buf, buflen, 0); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1177 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1178 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1179 |
// Either user didn't specify, or the user's location failed, |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1180 |
// so use the default name in the current directory |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1181 |
if (fd == -1) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1182 |
const char* cwd = os::get_current_directory(buf, buflen); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1183 |
if (cwd != NULL) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1184 |
size_t pos = strlen(cwd); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1185 |
int fsep_len = jio_snprintf(&buf[pos], buflen-pos, "%s", os::file_separator()); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1186 |
pos += fsep_len; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1187 |
if (fsep_len > 0) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1188 |
fd = expand_and_open(default_pattern, buf, buflen, pos); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1189 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1190 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1191 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1192 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1193 |
// try temp directory if it exists. |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1194 |
if (fd == -1) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1195 |
const char* tmpdir = os::get_temp_directory(); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1196 |
if (tmpdir != NULL && strlen(tmpdir) > 0) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1197 |
int pos = jio_snprintf(buf, buflen, "%s%s", tmpdir, os::file_separator()); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1198 |
if (pos > 0) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1199 |
fd = expand_and_open(default_pattern, buf, buflen, pos); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1200 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1201 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1202 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1203 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1204 |
return fd; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1205 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1206 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1207 |
int VMError::_id; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1208 |
const char* VMError::_message; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1209 |
char VMError::_detail_msg[1024]; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1210 |
Thread* VMError::_thread; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1211 |
address VMError::_pc; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1212 |
void* VMError::_siginfo; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1213 |
void* VMError::_context; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1214 |
const char* VMError::_filename; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1215 |
int VMError::_lineno; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1216 |
size_t VMError::_size; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1217 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1218 |
void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1219 |
void* context, const char* detail_fmt, ...) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1220 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1221 |
va_list detail_args; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1222 |
va_start(detail_args, detail_fmt); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1223 |
report_and_die(sig, NULL, detail_fmt, detail_args, thread, pc, siginfo, context, NULL, 0, 0); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1224 |
va_end(detail_args); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1225 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1226 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1227 |
void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1228 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1229 |
report_and_die(thread, sig, pc, siginfo, context, "%s", ""); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1230 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1231 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1232 |
void VMError::report_and_die(const char* message, const char* detail_fmt, ...) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1233 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1234 |
va_list detail_args; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1235 |
va_start(detail_args, detail_fmt); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1236 |
report_and_die(INTERNAL_ERROR, message, detail_fmt, detail_args, NULL, NULL, NULL, NULL, NULL, 0, 0); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1237 |
va_end(detail_args); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1238 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1239 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1240 |
void VMError::report_and_die(const char* message) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1241 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1242 |
report_and_die(message, "%s", ""); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1243 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1244 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1245 |
void VMError::report_and_die(Thread* thread, const char* filename, int lineno, const char* message, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1246 |
const char* detail_fmt, va_list detail_args) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1247 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1248 |
report_and_die(INTERNAL_ERROR, message, detail_fmt, detail_args, thread, NULL, NULL, NULL, filename, lineno, 0); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1249 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1250 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1251 |
void VMError::report_and_die(Thread* thread, const char* filename, int lineno, size_t size, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1252 |
VMErrorType vm_err_type, const char* detail_fmt, va_list detail_args) { |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1253 |
report_and_die(vm_err_type, NULL, detail_fmt, detail_args, thread, NULL, NULL, NULL, filename, lineno, size); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1254 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1255 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1256 |
void VMError::report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1257 |
Thread* thread, address pc, void* siginfo, void* context, const char* filename, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1258 |
int lineno, size_t size) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1259 |
{ |
1 | 1260 |
// Don't allocate large buffer on stack |
1261 |
static char buffer[O_BUFLEN]; |
|
35869 | 1262 |
out.set_scratch_buffer(buffer, sizeof(buffer)); |
1263 |
log.set_scratch_buffer(buffer, sizeof(buffer)); |
|
1 | 1264 |
|
1265 |
// How many errors occurred in error handler when reporting first_error. |
|
1266 |
static int recursive_error_count; |
|
1267 |
||
1268 |
// We will first print a brief message to standard out (verbose = false), |
|
1269 |
// then save detailed information in log file (verbose = true). |
|
1270 |
static bool out_done = false; // done printing to standard out |
|
1271 |
static bool log_done = false; // done saving error log |
|
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1272 |
static bool transmit_report_done = false; // done error reporting |
1 | 1273 |
|
1274 |
if (SuppressFatalErrorMessage) { |
|
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
1275 |
os::abort(CreateCoredumpOnCrash); |
1 | 1276 |
} |
33131
a8ad9de9e5a4
8138832: CreateCoredumpOnCrash on linux ARM causes assert message to be repeated.
david
parents:
33105
diff
changeset
|
1277 |
intptr_t mytid = os::current_thread_id(); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1278 |
if (first_error_tid == -1 && |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
1279 |
Atomic::cmpxchg(mytid, &first_error_tid, (intptr_t)-1) == -1) { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1280 |
|
36320
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1281 |
// Initialize time stamps to use the same base. |
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1282 |
out.time_stamp().update_to(1); |
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1283 |
log.time_stamp().update_to(1); |
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1284 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1285 |
_id = id; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1286 |
_message = message; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1287 |
_thread = thread; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1288 |
_pc = pc; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1289 |
_siginfo = siginfo; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1290 |
_context = context; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1291 |
_filename = filename; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1292 |
_lineno = lineno; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1293 |
_size = size; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1294 |
jio_vsnprintf(_detail_msg, sizeof(_detail_msg), detail_fmt, detail_args); |
1 | 1295 |
|
1296 |
// first time |
|
46589 | 1297 |
_error_reported = true; |
1 | 1298 |
|
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1299 |
reporting_started(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1300 |
record_reporting_start_time(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1301 |
|
8476
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
1302 |
if (ShowMessageBoxOnError || PauseAtExit) { |
1 | 1303 |
show_message_box(buffer, sizeof(buffer)); |
1304 |
||
1305 |
// User has asked JVM to abort. Reset ShowMessageBoxOnError so the |
|
1306 |
// WatcherThread can kill JVM if the error handler hangs. |
|
1307 |
ShowMessageBoxOnError = false; |
|
1308 |
} |
|
1309 |
||
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
1310 |
os::check_dump_limit(buffer, sizeof(buffer)); |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
1311 |
|
1 | 1312 |
// reset signal handlers or exception filter; make sure recursive crashes |
1313 |
// are handled properly. |
|
1314 |
reset_signal_handlers(); |
|
1315 |
||
39274
940f0e8e9ec2
8158033: Notify_tracing() misplaced for intended purpose
mgronlun
parents:
38215
diff
changeset
|
1316 |
TRACE_VM_ERROR(); |
940f0e8e9ec2
8158033: Notify_tracing() misplaced for intended purpose
mgronlun
parents:
38215
diff
changeset
|
1317 |
|
1 | 1318 |
} else { |
1887
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1319 |
// If UseOsErrorReporting we call this for each level of the call stack |
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1320 |
// while searching for the exception handler. Only the first level needs |
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1321 |
// to be reported. |
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1322 |
if (UseOSErrorReporting && log_done) return; |
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1323 |
|
1 | 1324 |
// This is not the first error, see if it happened in a different thread |
1325 |
// or in the same thread during error reporting. |
|
1326 |
if (first_error_tid != mytid) { |
|
18684 | 1327 |
char msgbuf[64]; |
1328 |
jio_snprintf(msgbuf, sizeof(msgbuf), |
|
33131
a8ad9de9e5a4
8138832: CreateCoredumpOnCrash on linux ARM causes assert message to be repeated.
david
parents:
33105
diff
changeset
|
1329 |
"[thread " INTX_FORMAT " also had an error]", |
1 | 1330 |
mytid); |
18684 | 1331 |
out.print_raw_cr(msgbuf); |
1 | 1332 |
|
1333 |
// error reporting is not MT-safe, block current thread |
|
1334 |
os::infinite_sleep(); |
|
1335 |
||
1336 |
} else { |
|
1337 |
if (recursive_error_count++ > 30) { |
|
1338 |
out.print_raw_cr("[Too many errors, abort]"); |
|
1339 |
os::die(); |
|
1340 |
} |
|
1341 |
||
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1342 |
outputStream* const st = log.is_open() ? &log : &out; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1343 |
st->cr(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1344 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1345 |
// Timeout handling. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1346 |
if (_step_did_timeout) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1347 |
// The current step had a timeout. Lets continue reporting with the next step. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1348 |
st->print_raw("[timeout occurred during error reporting in step \""); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1349 |
st->print_raw(_current_step_info); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1350 |
st->print_cr("\"] after " INT64_FORMAT " s.", |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46589
diff
changeset
|
1351 |
(int64_t) |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46589
diff
changeset
|
1352 |
((get_current_timestamp() - _step_start_time) / TIMESTAMP_TO_SECONDS_FACTOR)); |
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1353 |
} else if (_reporting_did_timeout) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1354 |
// We hit ErrorLogTimeout. Reporting will stop altogether. Let's wrap things |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1355 |
// up, the process is about to be stopped by the WatcherThread. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1356 |
st->print_cr("------ Timeout during error reporting after " INT64_FORMAT " s. ------", |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46589
diff
changeset
|
1357 |
(int64_t) |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46589
diff
changeset
|
1358 |
((get_current_timestamp() - _reporting_start_time) / TIMESTAMP_TO_SECONDS_FACTOR)); |
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1359 |
st->flush(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1360 |
// Watcherthread is about to call os::die. Lets just wait. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1361 |
os::infinite_sleep(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1362 |
} else { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1363 |
// Crash or assert during error reporting. Lets continue reporting with the next step. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1364 |
jio_snprintf(buffer, sizeof(buffer), |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1365 |
"[error occurred during error reporting (%s), id 0x%x]", |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1366 |
_current_step_info, _id); |
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1367 |
st->print_raw_cr(buffer); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1368 |
st->cr(); |
1 | 1369 |
} |
1370 |
} |
|
1371 |
} |
|
1372 |
||
1373 |
// print to screen |
|
1374 |
if (!out_done) { |
|
35869 | 1375 |
report(&out, false); |
1 | 1376 |
|
1377 |
out_done = true; |
|
1378 |
||
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1379 |
_current_step = 0; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1380 |
_current_step_info = ""; |
1 | 1381 |
} |
1382 |
||
1383 |
// print to error log file |
|
1384 |
if (!log_done) { |
|
1385 |
// see if log file is already open |
|
1386 |
if (!log.is_open()) { |
|
1387 |
// open log file |
|
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1388 |
int fd = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer)); |
1 | 1389 |
if (fd != -1) { |
1390 |
out.print_raw("# An error report file with more information is saved as:\n# "); |
|
1391 |
out.print_raw_cr(buffer); |
|
1392 |
||
1393 |
log.set_fd(fd); |
|
1394 |
} else { |
|
1395 |
out.print_raw_cr("# Can not save log file, dump to screen.."); |
|
1396 |
log.set_fd(defaultStream::output_fd()); |
|
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1397 |
/* Error reporting currently needs dumpfile. |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1398 |
* Maybe implement direct streaming in the future.*/ |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1399 |
transmit_report_done = true; |
1 | 1400 |
} |
1401 |
} |
|
1402 |
||
35869 | 1403 |
report(&log, true); |
46320
a38f07dfcf47
8176140: 8176140-Crashes-or-timeouts-during-error-reporting-may-lead-to-infinitely-repeated-error-logs-until-ErrorLogTimeout-is-hit
stuefe
parents:
46284
diff
changeset
|
1404 |
log_done = true; |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1405 |
_current_step = 0; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1406 |
_current_step_info = ""; |
1 | 1407 |
|
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1408 |
// Run error reporting to determine whether or not to report the crash. |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1409 |
if (!transmit_report_done && should_report_bug(_id)) { |
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1410 |
transmit_report_done = true; |
27471 | 1411 |
const int fd2 = ::dup(log.fd()); |
46501 | 1412 |
if (fd2 != -1) { |
1413 |
FILE* const hs_err = ::fdopen(fd2, "r"); |
|
1414 |
if (NULL != hs_err) { |
|
1415 |
ErrorReporter er; |
|
1416 |
er.call(hs_err, buffer, O_BUFLEN); |
|
1417 |
::fclose(hs_err); |
|
1418 |
} |
|
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1419 |
} |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1420 |
} |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1421 |
|
1 | 1422 |
if (log.fd() != defaultStream::output_fd()) { |
1423 |
close(log.fd()); |
|
1424 |
} |
|
1425 |
||
1426 |
log.set_fd(-1); |
|
1427 |
} |
|
1428 |
||
22243 | 1429 |
static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1430 |
if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1431 |
skip_replay = true; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1432 |
ciEnv* env = ciEnv::current(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1433 |
if (env != NULL) { |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1434 |
int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", buffer, sizeof(buffer)); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1435 |
if (fd != -1) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1436 |
FILE* replay_data_file = os::open(fd, "w"); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1437 |
if (replay_data_file != NULL) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1438 |
fileStream replay_data_stream(replay_data_file, /*need_close=*/true); |
20692
65021f70c2fc
8024943: ciReplay: fails to dump replay data during safepointing
vlivanov
parents:
19952
diff
changeset
|
1439 |
env->dump_replay_data_unsafe(&replay_data_stream); |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1440 |
out.print_raw("#\n# Compiler replay data is saved as:\n# "); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1441 |
out.print_raw_cr(buffer); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1442 |
} else { |
37113 | 1443 |
int e = errno; |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1444 |
out.print_raw("#\n# Can't open file to dump replay data. Error: "); |
37113 | 1445 |
out.print_raw_cr(os::strerror(e)); |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1446 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1447 |
} |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1448 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1449 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1450 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1451 |
static bool skip_bug_url = !should_report_bug(_id); |
1 | 1452 |
if (!skip_bug_url) { |
1453 |
skip_bug_url = true; |
|
1454 |
||
1455 |
out.print_raw_cr("#"); |
|
1456 |
print_bug_submit_message(&out, _thread); |
|
1457 |
} |
|
1458 |
||
35568
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1459 |
static bool skip_OnError = false; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1460 |
if (!skip_OnError && OnError && OnError[0]) { |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1461 |
skip_OnError = true; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1462 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1463 |
// Flush output and finish logs before running OnError commands. |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1464 |
ostream_abort(); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1465 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1466 |
out.print_raw_cr("#"); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1467 |
out.print_raw ("# -XX:OnError=\""); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1468 |
out.print_raw (OnError); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1469 |
out.print_raw_cr("\""); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1470 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1471 |
char* cmd; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1472 |
const char* ptr = OnError; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1473 |
while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1474 |
out.print_raw ("# Executing "); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1475 |
#if defined(LINUX) || defined(_ALLBSD_SOURCE) |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1476 |
out.print_raw ("/bin/sh -c "); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1477 |
#elif defined(SOLARIS) |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1478 |
out.print_raw ("/usr/bin/sh -c "); |
46476
8ead62daaa47
8177522: -XX:OnOutOfMemoryError does not work if supplied twice on windows
vkempik
parents:
46320
diff
changeset
|
1479 |
#elif defined(WINDOWS) |
8ead62daaa47
8177522: -XX:OnOutOfMemoryError does not work if supplied twice on windows
vkempik
parents:
46320
diff
changeset
|
1480 |
out.print_raw ("cmd /C "); |
35568
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1481 |
#endif |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1482 |
out.print_raw ("\""); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1483 |
out.print_raw (cmd); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1484 |
out.print_raw_cr("\" ..."); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1485 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1486 |
if (os::fork_and_exec(cmd) < 0) { |
37113 | 1487 |
out.print_cr("os::fork_and_exec failed: %s (%s=%d)", |
1488 |
os::strerror(errno), os::errno_name(errno), errno); |
|
35568
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1489 |
} |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1490 |
} |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1491 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1492 |
// done with OnError |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1493 |
OnError = NULL; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1494 |
} |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1495 |
|
1 | 1496 |
if (!UseOSErrorReporting) { |
1497 |
// os::abort() will call abort hooks, try it first. |
|
1498 |
static bool skip_os_abort = false; |
|
1499 |
if (!skip_os_abort) { |
|
1500 |
skip_os_abort = true; |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1501 |
bool dump_core = should_report_bug(_id); |
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
1502 |
os::abort(dump_core && CreateCoredumpOnCrash, _siginfo, _context); |
1 | 1503 |
} |
1504 |
||
1505 |
// if os::abort() doesn't abort, try os::die(); |
|
1506 |
os::die(); |
|
1507 |
} |
|
1508 |
} |
|
1509 |
||
1510 |
/* |
|
1511 |
* OnOutOfMemoryError scripts/commands executed while VM is a safepoint - this |
|
1512 |
* ensures utilities such as jmap can observe the process is a consistent state. |
|
1513 |
*/ |
|
1514 |
class VM_ReportJavaOutOfMemory : public VM_Operation { |
|
1515 |
private: |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1516 |
const char* _message; |
1 | 1517 |
public: |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1518 |
VM_ReportJavaOutOfMemory(const char* message) { _message = message; } |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1519 |
VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; } |
1 | 1520 |
void doit(); |
1521 |
}; |
|
1522 |
||
1523 |
void VM_ReportJavaOutOfMemory::doit() { |
|
1524 |
// Don't allocate large buffer on stack |
|
1525 |
static char buffer[O_BUFLEN]; |
|
1526 |
||
1527 |
tty->print_cr("#"); |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1528 |
tty->print_cr("# java.lang.OutOfMemoryError: %s", _message); |
1 | 1529 |
tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError); |
1530 |
||
1531 |
// make heap parsability |
|
1532 |
Universe::heap()->ensure_parsability(false); // no need to retire TLABs |
|
1533 |
||
1534 |
char* cmd; |
|
1535 |
const char* ptr = OnOutOfMemoryError; |
|
1536 |
while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ |
|
1537 |
tty->print("# Executing "); |
|
1538 |
#if defined(LINUX) |
|
1539 |
tty->print ("/bin/sh -c "); |
|
1540 |
#elif defined(SOLARIS) |
|
1541 |
tty->print ("/usr/bin/sh -c "); |
|
1542 |
#endif |
|
1543 |
tty->print_cr("\"%s\"...", cmd); |
|
1544 |
||
30745
8ebe80838174
8078470: [Linux] Replace syscall use in os::fork_and_exec with glibc fork() and execve()
dholmes
parents:
30622
diff
changeset
|
1545 |
if (os::fork_and_exec(cmd) < 0) { |
37113 | 1546 |
tty->print_cr("os::fork_and_exec failed: %s (%s=%d)", |
1547 |
os::strerror(errno), os::errno_name(errno), errno); |
|
30745
8ebe80838174
8078470: [Linux] Replace syscall use in os::fork_and_exec with glibc fork() and execve()
dholmes
parents:
30622
diff
changeset
|
1548 |
} |
1 | 1549 |
} |
1550 |
} |
|
1551 |
||
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1552 |
void VMError::report_java_out_of_memory(const char* message) { |
1 | 1553 |
if (OnOutOfMemoryError && OnOutOfMemoryError[0]) { |
1554 |
MutexLocker ml(Heap_lock); |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1555 |
VM_ReportJavaOutOfMemory op(message); |
1 | 1556 |
VMThread::execute(&op); |
1557 |
} |
|
1558 |
} |
|
34305
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1559 |
|
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1560 |
void VMError::show_message_box(char *buf, int buflen) { |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1561 |
bool yes; |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1562 |
do { |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1563 |
error_string(buf, buflen); |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1564 |
yes = os::start_debugging(buf,buflen); |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1565 |
} while (yes); |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1566 |
} |
46284
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1567 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1568 |
// Timeout handling: check if a timeout happened (either a single step did |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1569 |
// timeout or the whole of error reporting hit ErrorLogTimeout). Interrupt |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1570 |
// the reporting thread if that is the case. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1571 |
bool VMError::check_timeout() { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1572 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1573 |
if (ErrorLogTimeout == 0) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1574 |
return false; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1575 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1576 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1577 |
// Do not check for timeouts if we still have a message box to show to the |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1578 |
// user or if there are OnError handlers to be run. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1579 |
if (ShowMessageBoxOnError |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1580 |
|| (OnError != NULL && OnError[0] != '\0') |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1581 |
|| Arguments::abort_hook() != NULL) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1582 |
return false; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1583 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1584 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1585 |
const jlong reporting_start_time_l = get_reporting_start_time(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1586 |
const jlong now = get_current_timestamp(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1587 |
// Timestamp is stored in nanos. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1588 |
if (reporting_start_time_l > 0) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1589 |
const jlong end = reporting_start_time_l + (jlong)ErrorLogTimeout * TIMESTAMP_TO_SECONDS_FACTOR; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1590 |
if (end <= now) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1591 |
_reporting_did_timeout = true; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1592 |
interrupt_reporting_thread(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1593 |
return true; // global timeout |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1594 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1595 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1596 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1597 |
const jlong step_start_time_l = get_step_start_time(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1598 |
if (step_start_time_l > 0) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1599 |
// A step times out after a quarter of the total timeout. Steps are mostly fast unless they |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1600 |
// hang for some reason, so this simple rule allows for three hanging step and still |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1601 |
// hopefully leaves time enough for the rest of the steps to finish. |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1602 |
const jlong end = step_start_time_l + (jlong)ErrorLogTimeout * TIMESTAMP_TO_SECONDS_FACTOR / 4; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1603 |
if (end <= now) { |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1604 |
_step_did_timeout = true; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1605 |
interrupt_reporting_thread(); |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1606 |
return false; // (Not a global timeout) |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1607 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1608 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1609 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1610 |
return false; |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1611 |
|
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1612 |
} |
ad578adff5df
8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents:
40655
diff
changeset
|
1613 |
|
46589 | 1614 |
#ifndef PRODUCT |
1615 |
typedef void (*voidfun_t)(); |
|
1616 |
// Crash with an authentic sigfpe |
|
1617 |
static void crash_with_sigfpe() { |
|
1618 |
// generate a native synchronous SIGFPE where possible; |
|
1619 |
// if that did not cause a signal (e.g. on ppc), just |
|
1620 |
// raise the signal. |
|
1621 |
volatile int x = 0; |
|
1622 |
volatile int y = 1/x; |
|
1623 |
#ifndef _WIN32 |
|
1624 |
// OSX implements raise(sig) incorrectly so we need to |
|
1625 |
// explicitly target the current thread |
|
1626 |
pthread_kill(pthread_self(), SIGFPE); |
|
1627 |
#endif |
|
1628 |
} // end: crash_with_sigfpe |
|
1629 |
||
1630 |
// crash with sigsegv at non-null address. |
|
1631 |
static void crash_with_segfault() { |
|
1632 |
||
1633 |
char* const crash_addr = (char*) VMError::get_segfault_address(); |
|
1634 |
*crash_addr = 'X'; |
|
1635 |
||
1636 |
} // end: crash_with_segfault |
|
1637 |
||
1638 |
void VMError::test_error_handler() { |
|
1639 |
controlled_crash(ErrorHandlerTest); |
|
1640 |
} |
|
1641 |
||
1642 |
// crash in a controlled way: |
|
1643 |
// how can be one of: |
|
1644 |
// 1,2 - asserts |
|
1645 |
// 3,4 - guarantee |
|
1646 |
// 5-7 - fatal |
|
1647 |
// 8 - vm_exit_out_of_memory |
|
1648 |
// 9 - ShouldNotCallThis |
|
1649 |
// 10 - ShouldNotReachHere |
|
1650 |
// 11 - Unimplemented |
|
1651 |
// 12,13 - (not guaranteed) crashes |
|
1652 |
// 14 - SIGSEGV |
|
1653 |
// 15 - SIGFPE |
|
1654 |
void VMError::controlled_crash(int how) { |
|
1655 |
if (how == 0) return; |
|
1656 |
||
1657 |
// If asserts are disabled, use the corresponding guarantee instead. |
|
1658 |
NOT_DEBUG(if (how <= 2) how += 2); |
|
1659 |
||
1660 |
const char* const str = "hello"; |
|
1661 |
const size_t num = (size_t)os::vm_page_size(); |
|
1662 |
||
1663 |
const char* const eol = os::line_separator(); |
|
1664 |
const char* const msg = "this message should be truncated during formatting"; |
|
1665 |
char * const dataPtr = NULL; // bad data pointer |
|
1666 |
const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer |
|
1667 |
||
1668 |
// Keep this in sync with test/runtime/ErrorHandling/ErrorHandler.java |
|
1669 |
switch (how) { |
|
1670 |
case 1: vmassert(str == NULL, "expected null"); |
|
1671 |
case 2: vmassert(num == 1023 && *str == 'X', |
|
1672 |
"num=" SIZE_FORMAT " str=\"%s\"", num, str); |
|
1673 |
case 3: guarantee(str == NULL, "expected null"); |
|
1674 |
case 4: guarantee(num == 1023 && *str == 'X', |
|
1675 |
"num=" SIZE_FORMAT " str=\"%s\"", num, str); |
|
1676 |
case 5: fatal("expected null"); |
|
1677 |
case 6: fatal("num=" SIZE_FORMAT " str=\"%s\"", num, str); |
|
1678 |
case 7: fatal("%s%s# %s%s# %s%s# %s%s# %s%s# " |
|
1679 |
"%s%s# %s%s# %s%s# %s%s# %s%s# " |
|
1680 |
"%s%s# %s%s# %s%s# %s%s# %s", |
|
1681 |
msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, |
|
1682 |
msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, |
|
1683 |
msg, eol, msg, eol, msg, eol, msg, eol, msg); |
|
1684 |
case 8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate"); |
|
1685 |
case 9: ShouldNotCallThis(); |
|
1686 |
case 10: ShouldNotReachHere(); |
|
1687 |
case 11: Unimplemented(); |
|
1688 |
// There's no guarantee the bad data pointer will crash us |
|
1689 |
// so "break" out to the ShouldNotReachHere(). |
|
1690 |
case 12: *dataPtr = '\0'; break; |
|
1691 |
// There's no guarantee the bad function pointer will crash us |
|
1692 |
// so "break" out to the ShouldNotReachHere(). |
|
1693 |
case 13: (*funcPtr)(); break; |
|
1694 |
case 14: crash_with_segfault(); break; |
|
1695 |
case 15: crash_with_sigfpe(); break; |
|
1696 |
||
1697 |
default: tty->print_cr("ERROR: %d: unexpected test_num value.", how); |
|
1698 |
} |
|
1699 |
ShouldNotReachHere(); |
|
1700 |
} |
|
1701 |
#endif // !PRODUCT |
|
1702 |