author | tschatzl |
Mon, 15 May 2017 12:20:15 +0200 | |
changeset 45114 | 45644c5f6b8e |
parent 40655 | 9f644073d3a0 |
child 46284 | ad578adff5df |
permissions | -rw-r--r-- |
1 | 1 |
/* |
35453
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
2 |
* Copyright (c) 2003, 2016, 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 |
||
28513
9464a1b5c184
8050807: Better performing performance data handling
gthornbr
parents:
27471
diff
changeset
|
25 |
#include <fcntl.h> |
7397 | 26 |
#include "precompiled.hpp" |
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
25351
diff
changeset
|
27 |
#include "code/codeCache.hpp" |
7397 | 28 |
#include "compiler/compileBroker.hpp" |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
29 |
#include "compiler/disassembler.hpp" |
30764 | 30 |
#include "gc/shared/collectedHeap.hpp" |
37994
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
31 |
#include "logging/logConfiguration.hpp" |
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" |
|
13195 | 41 |
#include "services/memTracker.hpp" |
39274
940f0e8e9ec2
8158033: Notify_tracing() misplaced for intended purpose
mgronlun
parents:
38215
diff
changeset
|
42 |
#include "trace/traceMacros.hpp" |
7397 | 43 |
#include "utilities/debug.hpp" |
7447
32c42d627f41
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
7397
diff
changeset
|
44 |
#include "utilities/decoder.hpp" |
7397 | 45 |
#include "utilities/defaultStream.hpp" |
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
46 |
#include "utilities/errorReporter.hpp" |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
47 |
#include "utilities/events.hpp" |
7397 | 48 |
#include "utilities/vmError.hpp" |
1 | 49 |
|
50 |
// List of environment variables that should be reported in error log file. |
|
51 |
const char *env_list[] = { |
|
52 |
// All platforms |
|
53 |
"JAVA_HOME", "JRE_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH", |
|
54 |
"JAVA_COMPILER", "PATH", "USERNAME", |
|
55 |
||
10565 | 56 |
// Env variables that are defined on Solaris/Linux/BSD |
1 | 57 |
"LD_LIBRARY_PATH", "LD_PRELOAD", "SHELL", "DISPLAY", |
58 |
"HOSTTYPE", "OSTYPE", "ARCH", "MACHTYPE", |
|
59 |
||
60 |
// defined on Linux |
|
61 |
"LD_ASSUME_KERNEL", "_JAVA_SR_SIGNUM", |
|
62 |
||
10565 | 63 |
// defined on Darwin |
64 |
"DYLD_LIBRARY_PATH", "DYLD_FALLBACK_LIBRARY_PATH", |
|
65 |
"DYLD_FRAMEWORK_PATH", "DYLD_FALLBACK_FRAMEWORK_PATH", |
|
66 |
"DYLD_INSERT_LIBRARIES", |
|
67 |
||
1 | 68 |
// defined on Windows |
69 |
"OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", |
|
70 |
||
71 |
(const char *)0 |
|
72 |
}; |
|
73 |
||
74 |
// A simple parser for -XX:OnError, usage: |
|
75 |
// ptr = OnError; |
|
76 |
// while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr) != NULL) |
|
77 |
// ... ... |
|
78 |
static char* next_OnError_command(char* buf, int buflen, const char** ptr) { |
|
79 |
if (ptr == NULL || *ptr == NULL) return NULL; |
|
80 |
||
81 |
const char* cmd = *ptr; |
|
82 |
||
83 |
// skip leading blanks or ';' |
|
84 |
while (*cmd == ' ' || *cmd == ';') cmd++; |
|
85 |
||
86 |
if (*cmd == '\0') return NULL; |
|
87 |
||
88 |
const char * cmdend = cmd; |
|
89 |
while (*cmdend != '\0' && *cmdend != ';') cmdend++; |
|
90 |
||
91 |
Arguments::copy_expand_pid(cmd, cmdend - cmd, buf, buflen); |
|
92 |
||
93 |
*ptr = (*cmdend == '\0' ? cmdend : cmdend + 1); |
|
94 |
return buf; |
|
95 |
} |
|
96 |
||
97 |
static void print_bug_submit_message(outputStream *out, Thread *thread) { |
|
98 |
if (out == NULL) return; |
|
99 |
out->print_raw_cr("# If you would like to submit a bug report, please visit:"); |
|
100 |
out->print_raw ("# "); |
|
101 |
out->print_raw_cr(Arguments::java_vendor_url_bug()); |
|
102 |
// If the crash is in native code, encourage user to submit a bug to the |
|
103 |
// provider of that code. |
|
229
4fddba548751
6549844: Wording problems in "An unexpected error ..."
coleenp
parents:
1
diff
changeset
|
104 |
if (thread && thread->is_Java_thread() && |
4fddba548751
6549844: Wording problems in "An unexpected error ..."
coleenp
parents:
1
diff
changeset
|
105 |
!thread->is_hidden_from_external_view()) { |
1 | 106 |
JavaThread* jt = (JavaThread*)thread; |
107 |
if (jt->thread_state() == _thread_in_native) { |
|
108 |
out->print_cr("# The crash happened outside the Java Virtual Machine in native code.\n# See problematic frame for where to report the bug."); |
|
109 |
} |
|
110 |
} |
|
111 |
out->print_raw_cr("#"); |
|
112 |
} |
|
113 |
||
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
114 |
bool VMError::coredump_status; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
115 |
char VMError::coredump_message[O_BUFLEN]; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
116 |
|
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
117 |
void VMError::record_coredump_status(const char* message, bool status) { |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
118 |
coredump_status = status; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
119 |
strncpy(coredump_message, message, sizeof(coredump_message)); |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
120 |
coredump_message[sizeof(coredump_message)-1] = 0; |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
121 |
} |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
122 |
|
1 | 123 |
// Return a string to describe the error |
124 |
char* VMError::error_string(char* buf, int buflen) { |
|
125 |
char signame_buf[64]; |
|
126 |
const char *signame = os::exception_name(_id, signame_buf, sizeof(signame_buf)); |
|
127 |
||
128 |
if (signame) { |
|
129 |
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
|
130 |
"%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT, |
1 | 131 |
signame, _id, _pc, |
132 |
os::current_process_id(), os::current_thread_id()); |
|
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
133 |
} else if (_filename != NULL && _lineno > 0) { |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
134 |
// skip directory names |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
135 |
char separator = os::file_separator()[0]; |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
136 |
const char *p = strrchr(_filename, separator); |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
137 |
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
|
138 |
"Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT, |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
139 |
p ? p + 1 : _filename, _lineno, |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
140 |
os::current_process_id(), os::current_thread_id()); |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
141 |
if (n >= 0 && n < buflen && _message) { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
142 |
if (strlen(_detail_msg) > 0) { |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
143 |
jio_snprintf(buf + n, buflen - n, "%s%s: %s", |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
144 |
os::line_separator(), _message, _detail_msg); |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
145 |
} else { |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
146 |
jio_snprintf(buf + n, buflen - n, "%sError: %s", |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
147 |
os::line_separator(), _message); |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
148 |
} |
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
149 |
} |
1 | 150 |
} else { |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
151 |
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
|
152 |
"Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT, |
5403
6b0dd9c75dde
6888954: argument formatting for assert() and friends
jcoomes
parents:
5340
diff
changeset
|
153 |
_id, os::current_process_id(), os::current_thread_id()); |
1 | 154 |
} |
155 |
||
156 |
return buf; |
|
157 |
} |
|
158 |
||
5340 | 159 |
void VMError::print_stack_trace(outputStream* st, JavaThread* jt, |
160 |
char* buf, int buflen, bool verbose) { |
|
161 |
#ifdef ZERO |
|
162 |
if (jt->zero_stack()->sp() && jt->top_zero_frame()) { |
|
163 |
// StackFrameStream uses the frame anchor, which may not have |
|
164 |
// been set up. This can be done at any time in Zero, however, |
|
165 |
// so if it hasn't been set up then we just set it up now and |
|
166 |
// clear it again when we're done. |
|
167 |
bool has_last_Java_frame = jt->has_last_Java_frame(); |
|
168 |
if (!has_last_Java_frame) |
|
169 |
jt->set_last_Java_frame(); |
|
170 |
st->print("Java frames:"); |
|
171 |
||
172 |
// If the top frame is a Shark frame and the frame anchor isn't |
|
173 |
// set up then it's possible that the information in the frame |
|
174 |
// is garbage: it could be from a previous decache, or it could |
|
175 |
// simply have never been written. So we print a warning... |
|
176 |
StackFrameStream sfs(jt); |
|
177 |
if (!has_last_Java_frame && !sfs.is_done()) { |
|
178 |
if (sfs.current()->zeroframe()->is_shark_frame()) { |
|
179 |
st->print(" (TOP FRAME MAY BE JUNK)"); |
|
180 |
} |
|
181 |
} |
|
182 |
st->cr(); |
|
183 |
||
184 |
// Print the frames |
|
185 |
for(int i = 0; !sfs.is_done(); sfs.next(), i++) { |
|
186 |
sfs.current()->zero_print_on_error(i, st, buf, buflen); |
|
187 |
st->cr(); |
|
188 |
} |
|
189 |
||
190 |
// Reset the frame anchor if necessary |
|
191 |
if (!has_last_Java_frame) |
|
192 |
jt->reset_last_Java_frame(); |
|
193 |
} |
|
194 |
#else |
|
195 |
if (jt->has_last_Java_frame()) { |
|
196 |
st->print_cr("Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)"); |
|
197 |
for(StackFrameStream sfs(jt); !sfs.is_done(); sfs.next()) { |
|
198 |
sfs.current()->print_on_error(st, buf, buflen, verbose); |
|
199 |
st->cr(); |
|
200 |
} |
|
201 |
} |
|
202 |
#endif // ZERO |
|
203 |
} |
|
1 | 204 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
205 |
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
|
206 |
st->print_cr("# Possible reasons:"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
207 |
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
|
208 |
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
|
209 |
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
|
210 |
} |
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
|
211 |
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
|
212 |
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
|
213 |
} |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
214 |
st->print_cr("# Possible solutions:"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
215 |
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
|
216 |
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
|
217 |
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
|
218 |
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
|
219 |
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
|
220 |
} |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
221 |
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
|
222 |
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
|
223 |
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
|
224 |
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
|
225 |
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
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
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
|
230 |
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
|
231 |
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
|
232 |
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
|
233 |
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
|
234 |
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
|
235 |
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
|
236 |
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
|
237 |
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
|
238 |
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
|
239 |
} |
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
|
240 |
} |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
241 |
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
|
242 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
243 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
244 |
static const char* gc_mode() { |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
245 |
if (UseG1GC) return "g1 gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
246 |
if (UseParallelGC) return "parallel gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
247 |
if (UseConcMarkSweepGC) return "concurrent mark sweep gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
248 |
if (UseSerialGC) return "serial gc"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
249 |
return "ERROR in GC mode"; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
250 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
251 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
252 |
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
|
253 |
// VM version |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
254 |
st->print_cr("#"); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
255 |
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
|
256 |
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
|
257 |
JDK_Version::runtime_name() : ""; |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
258 |
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
|
259 |
JDK_Version::runtime_version() : ""; |
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
260 |
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
|
261 |
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
|
262 |
|
d164ee5260a6
8146653: Debug version missing in hs_err files and on internal version after Verona
amurillo
parents:
35176
diff
changeset
|
263 |
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
|
264 |
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
|
265 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
266 |
// 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
|
267 |
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
|
268 |
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
|
269 |
jdk_debug_level, |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
270 |
Abstract_VM_Version::vm_release(), |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
271 |
Abstract_VM_Version::vm_info_string(), |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
272 |
TieredCompilation ? ", tiered" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
273 |
#if INCLUDE_JVMCI |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
274 |
EnableJVMCI ? ", jvmci" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
275 |
UseJVMCICompiler ? ", jvmci compiler" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
276 |
#else |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
277 |
"", "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
278 |
#endif |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
279 |
UseCompressedOops ? ", compressed oops" : "", |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
280 |
gc_mode(), |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
281 |
Abstract_VM_Version::vm_platform_string() |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
282 |
); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
283 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
284 |
|
1 | 285 |
// This is the main function to report a fatal error. Only one thread can |
286 |
// call this function, so we don't need to worry about MT-safety. But it's |
|
287 |
// possible that the error handler itself may crash or die on an internal |
|
288 |
// error, for example, when the stack/heap is badly damaged. We must be |
|
289 |
// able to handle recursive errors that happen inside error handler. |
|
290 |
// |
|
291 |
// Error reporting is done in several steps. If a crash or internal error |
|
292 |
// occurred when reporting an error, the nested signal/exception handler |
|
293 |
// can skip steps that are already (or partially) done. Error reporting will |
|
294 |
// continue from the next step. This allows us to retrieve and print |
|
295 |
// information that may be unsafe to get after a fatal error. If it happens, |
|
296 |
// you may find nested report_and_die() frames when you look at the stack |
|
297 |
// in a debugger. |
|
298 |
// |
|
299 |
// In general, a hang in error handler is much worse than a crash or internal |
|
300 |
// error, as it's harder to recover from a hang. Deadlock can happen if we |
|
301 |
// try to grab a lock that is already owned by current thread, or if the |
|
302 |
// owner is blocked forever (e.g. in os::infinite_sleep()). If possible, the |
|
303 |
// error handler and all the functions it called should avoid grabbing any |
|
304 |
// lock. An important thing to notice is that memory allocation needs a lock. |
|
305 |
// |
|
306 |
// We should avoid using large stack allocated buffers. Many errors happen |
|
307 |
// when stack space is already low. Making things even worse is that there |
|
308 |
// could be nested report_and_die() calls on stack (see above). Only one |
|
309 |
// thread can report error, so large buffers are statically allocated in data |
|
310 |
// segment. |
|
311 |
||
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
312 |
int VMError::_current_step; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
313 |
const char* VMError::_current_step_info; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
314 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
315 |
void VMError::report(outputStream* st, bool _verbose) { |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
316 |
|
38215 | 317 |
# define BEGIN if (_current_step == 0) { _current_step = __LINE__; |
318 |
# define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s; |
|
1 | 319 |
# define END } |
320 |
||
321 |
// don't allocate large buffer on stack |
|
322 |
static char buf[O_BUFLEN]; |
|
323 |
||
324 |
BEGIN |
|
325 |
||
38215 | 326 |
STEP("printing fatal error message") |
1 | 327 |
|
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
328 |
st->print_cr("#"); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
329 |
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
|
330 |
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
|
331 |
} else { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
332 |
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
|
333 |
"Runtime Environment to continue."); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
334 |
} |
1 | 335 |
|
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
336 |
#ifndef PRODUCT |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
337 |
// Error handler self tests |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
338 |
|
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
339 |
// 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
|
340 |
// error handler after a secondary crash works. |
38215 | 341 |
STEP("test secondary crash 1") |
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
342 |
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
|
343 |
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
|
344 |
TestCrashInErrorHandler); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
345 |
controlled_crash(TestCrashInErrorHandler); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
346 |
} |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
347 |
|
38215 | 348 |
STEP("test secondary crash 2") |
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
349 |
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
|
350 |
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
|
351 |
TestCrashInErrorHandler); |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
352 |
controlled_crash(TestCrashInErrorHandler); |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
353 |
} |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
354 |
|
38215 | 355 |
STEP("test safefetch in error handler") |
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
356 |
// 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
|
357 |
// 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
|
358 |
if (_verbose && TestSafeFetchInErrorHandler) { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
359 |
st->print_cr("Will test SafeFetch..."); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
360 |
if (CanUseSafeFetch32()) { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
361 |
int* const invalid_pointer = (int*) get_segfault_address(); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
362 |
const int x = 0x76543210; |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
363 |
int i1 = SafeFetch32(invalid_pointer, x); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
364 |
int i2 = SafeFetch32(invalid_pointer, x); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
365 |
if (i1 == x && i2 == x) { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
366 |
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
|
367 |
} else { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
368 |
st->print_cr("??"); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
369 |
} |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
370 |
} else { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
371 |
st->print_cr("not possible; skipped."); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
28943
diff
changeset
|
372 |
} |
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
373 |
} |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
374 |
#endif // PRODUCT |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
375 |
|
38215 | 376 |
STEP("printing type of error") |
1 | 377 |
|
378 |
switch(_id) { |
|
17087
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
379 |
case OOM_MALLOC_ERROR: |
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
380 |
case OOM_MMAP_ERROR: |
1 | 381 |
if (_size) { |
17087
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
382 |
st->print("# Native memory allocation "); |
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
383 |
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
|
384 |
"(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
|
385 |
jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24351
diff
changeset
|
386 |
st->print("%s", buf); |
1 | 387 |
st->print(" bytes"); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
388 |
if (strlen(_detail_msg) > 0) { |
1 | 389 |
st->print(" for "); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
390 |
st->print("%s", _detail_msg); |
1 | 391 |
} |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
392 |
st->cr(); |
1 | 393 |
} else { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
394 |
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
|
395 |
st->print("# "); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
396 |
st->print_cr("%s", _detail_msg); |
31615 | 397 |
} |
1 | 398 |
} |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
399 |
// 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
|
400 |
if (_verbose) { |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
401 |
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
|
402 |
} else { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
403 |
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
|
404 |
} |
1 | 405 |
break; |
17087
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
16685
diff
changeset
|
406 |
case INTERNAL_ERROR: |
1 | 407 |
default: |
408 |
break; |
|
409 |
} |
|
410 |
||
38215 | 411 |
STEP("printing exception/signal name") |
1 | 412 |
|
413 |
st->print_cr("#"); |
|
414 |
st->print("# "); |
|
415 |
// Is it an OS exception/signal? |
|
416 |
if (os::exception_name(_id, buf, sizeof(buf))) { |
|
417 |
st->print("%s", buf); |
|
418 |
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
|
419 |
st->print(" at pc=" PTR_FORMAT, p2i(_pc)); |
1 | 420 |
} else { |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
421 |
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
|
422 |
st->print("Internal Error"); |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
423 |
} else { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
424 |
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
|
425 |
} |
1 | 426 |
if (_filename != NULL && _lineno > 0) { |
427 |
#ifdef PRODUCT |
|
428 |
// In product mode chop off pathname? |
|
429 |
char separator = os::file_separator()[0]; |
|
430 |
const char *p = strrchr(_filename, separator); |
|
431 |
const char *file = p ? p+1 : _filename; |
|
432 |
#else |
|
433 |
const char *file = _filename; |
|
434 |
#endif |
|
30281 | 435 |
st->print(" (%s:%d)", file, _lineno); |
1 | 436 |
} else { |
437 |
st->print(" (0x%x)", _id); |
|
438 |
} |
|
439 |
} |
|
440 |
||
38215 | 441 |
STEP("printing current thread and pid") |
1 | 442 |
|
443 |
// process id, thread id |
|
444 |
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
|
445 |
st->print(", tid=" UINTX_FORMAT, os::current_thread_id()); |
1 | 446 |
st->cr(); |
447 |
||
38215 | 448 |
STEP("printing error message") |
1 | 449 |
|
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
450 |
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
|
451 |
// error message |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
452 |
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
|
453 |
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
|
454 |
} else if (_message) { |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
455 |
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
|
456 |
} |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
457 |
} |
1 | 458 |
|
38215 | 459 |
STEP("printing Java version string") |
1 | 460 |
|
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
461 |
report_vm_version(st, buf, sizeof(buf)); |
1 | 462 |
|
38215 | 463 |
STEP("printing problematic frame") |
1 | 464 |
|
465 |
// Print current frame if we have a context (i.e. it's a crash) |
|
466 |
if (_context) { |
|
467 |
st->print_cr("# Problematic frame:"); |
|
468 |
st->print("# "); |
|
469 |
frame fr = os::fetch_frame_from_context(_context); |
|
470 |
fr.print_on_error(st, buf, sizeof(buf)); |
|
471 |
st->cr(); |
|
472 |
st->print_cr("#"); |
|
473 |
} |
|
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
474 |
|
38215 | 475 |
STEP("printing core file information") |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
476 |
st->print("# "); |
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
477 |
if (CreateCoredumpOnCrash) { |
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
478 |
if (coredump_status) { |
30622
648d51c142bd
8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
30281
diff
changeset
|
479 |
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
|
480 |
} else { |
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
481 |
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
|
482 |
} |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
483 |
} else { |
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
484 |
st->print("CreateCoredumpOnCrash turned off, no core file dumped"); |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
485 |
} |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24351
diff
changeset
|
486 |
st->cr(); |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
487 |
st->print_cr("#"); |
1 | 488 |
|
38215 | 489 |
STEP("printing bug submit message") |
1 | 490 |
|
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7447
diff
changeset
|
491 |
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
|
492 |
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
|
493 |
} |
1 | 494 |
|
38215 | 495 |
STEP("printing summary") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
496 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
497 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
498 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
499 |
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
|
500 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
501 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
502 |
|
38215 | 503 |
STEP("printing VM option summary") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
504 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
505 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
506 |
// VM options |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
507 |
Arguments::print_summary_on(st); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
508 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
509 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
510 |
|
38215 | 511 |
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
|
512 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
513 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
514 |
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
|
515 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
516 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
517 |
|
38215 | 518 |
STEP("printing date and time") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
519 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
520 |
if (_verbose) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
521 |
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
|
522 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
523 |
|
38215 | 524 |
STEP("printing thread") |
1 | 525 |
|
526 |
if (_verbose) { |
|
527 |
st->cr(); |
|
528 |
st->print_cr("--------------- T H R E A D ---------------"); |
|
529 |
st->cr(); |
|
530 |
} |
|
531 |
||
38215 | 532 |
STEP("printing current thread") |
1 | 533 |
|
534 |
// current thread |
|
535 |
if (_verbose) { |
|
536 |
if (_thread) { |
|
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
537 |
st->print("Current thread (" PTR_FORMAT "): ", p2i(_thread)); |
1 | 538 |
_thread->print_on_error(st, buf, sizeof(buf)); |
539 |
st->cr(); |
|
540 |
} else { |
|
541 |
st->print_cr("Current thread is native thread"); |
|
542 |
} |
|
543 |
st->cr(); |
|
544 |
} |
|
545 |
||
38215 | 546 |
STEP("printing current compile task") |
1 | 547 |
|
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
548 |
if (_verbose && _thread && _thread->is_Compiler_thread()) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
549 |
CompilerThread* t = (CompilerThread*)_thread; |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
550 |
if (t->task()) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
551 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
552 |
st->print_cr("Current CompileTask:"); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
553 |
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
|
554 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
555 |
} |
1 | 556 |
} |
557 |
||
558 |
||
38215 | 559 |
STEP("printing stack bounds") |
1 | 560 |
|
561 |
if (_verbose) { |
|
562 |
st->print("Stack: "); |
|
563 |
||
564 |
address stack_top; |
|
565 |
size_t stack_size; |
|
566 |
||
567 |
if (_thread) { |
|
568 |
stack_top = _thread->stack_base(); |
|
569 |
stack_size = _thread->stack_size(); |
|
570 |
} else { |
|
571 |
stack_top = os::current_stack_base(); |
|
572 |
stack_size = os::current_stack_size(); |
|
573 |
} |
|
574 |
||
575 |
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
|
576 |
st->print("[" PTR_FORMAT "," PTR_FORMAT "]", p2i(stack_bottom), p2i(stack_top)); |
1 | 577 |
|
578 |
frame fr = _context ? os::fetch_frame_from_context(_context) |
|
579 |
: os::current_frame(); |
|
580 |
||
581 |
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
|
582 |
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
|
583 |
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
|
584 |
st->print(", free space=" SIZE_FORMAT "k", free_stack_size); |
1 | 585 |
} |
586 |
||
587 |
st->cr(); |
|
588 |
} |
|
589 |
||
38215 | 590 |
STEP("printing native stack") |
1 | 591 |
|
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
|
592 |
if (_verbose) { |
19952
bc974e92f881
8022335: Native stack walk while generating hs_err does not work on Windows x64
iklam
parents:
19334
diff
changeset
|
593 |
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
|
594 |
// 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
|
595 |
// 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
|
596 |
} else { |
1 | 597 |
frame fr = _context ? os::fetch_frame_from_context(_context) |
598 |
: os::current_frame(); |
|
599 |
||
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
|
600 |
print_native_stack(st, fr, _thread, buf, sizeof(buf)); |
1 | 601 |
} |
19952
bc974e92f881
8022335: Native stack walk while generating hs_err does not work on Windows x64
iklam
parents:
19334
diff
changeset
|
602 |
} |
1 | 603 |
|
38215 | 604 |
STEP("printing Java stack") |
1 | 605 |
|
606 |
if (_verbose && _thread && _thread->is_Java_thread()) { |
|
5340 | 607 |
print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf)); |
1 | 608 |
} |
609 |
||
38215 | 610 |
STEP("printing target Java thread stack") |
4489
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
611 |
|
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
612 |
// printing Java thread stack trace if it is involved in GC crash |
7108 | 613 |
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
|
614 |
JavaThread* jt = ((NamedThread *)_thread)->processed_thread(); |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
615 |
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
|
616 |
st->print_cr("JavaThread " PTR_FORMAT " (nid = %d) was being processed", p2i(jt), jt->osthread()->thread_id()); |
5340 | 617 |
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
|
618 |
} |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
619 |
} |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
4013
diff
changeset
|
620 |
|
38215 | 621 |
STEP("printing siginfo") |
31963
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 |
// 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
|
624 |
if (_verbose && _siginfo) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
625 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
626 |
os::print_siginfo(st, _siginfo); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
627 |
st->cr(); |
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 |
|
38215 | 630 |
STEP("CDS archive access warning") |
35176
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
631 |
|
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
632 |
// 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
|
633 |
if (_verbose && _siginfo) { |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
634 |
check_failing_cds_access(st, _siginfo); |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
635 |
st->cr(); |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
636 |
} |
11a9d4022d9e
8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents:
34305
diff
changeset
|
637 |
|
38215 | 638 |
STEP("printing register info") |
31963
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
639 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
640 |
// decode register contents if possible |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
641 |
if (_verbose && _context && Universe::is_fully_initialized()) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
642 |
os::print_register_info(st, _context); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
643 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
644 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
645 |
|
38215 | 646 |
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
|
647 |
|
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
648 |
// registers, top of stack, instructions near pc |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
649 |
if (_verbose && _context) { |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
650 |
os::print_context(st, _context); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
651 |
st->cr(); |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
652 |
} |
641ed52732ec
8026324: hs_err improvement: Add summary section to hs_err file
coleenp
parents:
31615
diff
changeset
|
653 |
|
38215 | 654 |
STEP("printing code blob if possible") |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
655 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
656 |
if (_verbose && _context) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
657 |
CodeBlob* cb = CodeCache::find_blob(_pc); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
658 |
if (cb != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
659 |
if (Interpreter::contains(_pc)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
660 |
// 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
|
661 |
InterpreterCodelet* codelet = Interpreter::codelet_containing(_pc); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
662 |
if (codelet != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
663 |
codelet->print_on(st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
664 |
Disassembler::decode(codelet->code_begin(), codelet->code_end(), st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
665 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
666 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
667 |
StubCodeDesc* desc = StubCodeDesc::desc_for(_pc); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
668 |
if (desc != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
669 |
desc->print_on(st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
670 |
Disassembler::decode(desc->begin(), desc->end(), st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
671 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
672 |
Disassembler::decode(cb, st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
673 |
st->cr(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
674 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
675 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
676 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
677 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32583
diff
changeset
|
678 |
|
38215 | 679 |
STEP("printing VM operation") |
1 | 680 |
|
681 |
if (_verbose && _thread && _thread->is_VM_thread()) { |
|
682 |
VMThread* t = (VMThread*)_thread; |
|
683 |
VM_Operation* op = t->vm_operation(); |
|
684 |
if (op) { |
|
685 |
op->print_on_error(st); |
|
686 |
st->cr(); |
|
687 |
st->cr(); |
|
688 |
} |
|
689 |
} |
|
690 |
||
38215 | 691 |
STEP("printing process") |
1 | 692 |
|
693 |
if (_verbose) { |
|
694 |
st->cr(); |
|
695 |
st->print_cr("--------------- P R O C E S S ---------------"); |
|
696 |
st->cr(); |
|
697 |
} |
|
698 |
||
38215 | 699 |
STEP("printing all threads") |
1 | 700 |
|
701 |
// all threads |
|
702 |
if (_verbose && _thread) { |
|
703 |
Threads::print_on_error(st, _thread, buf, sizeof(buf)); |
|
704 |
st->cr(); |
|
705 |
} |
|
706 |
||
38215 | 707 |
STEP("printing VM state") |
1 | 708 |
|
709 |
if (_verbose) { |
|
710 |
// Safepoint state |
|
711 |
st->print("VM state:"); |
|
712 |
||
713 |
if (SafepointSynchronize::is_synchronizing()) st->print("synchronizing"); |
|
714 |
else if (SafepointSynchronize::is_at_safepoint()) st->print("at safepoint"); |
|
715 |
else st->print("not at safepoint"); |
|
716 |
||
717 |
// Also see if error occurred during initialization or shutdown |
|
718 |
if (!Universe::is_fully_initialized()) { |
|
719 |
st->print(" (not fully initialized)"); |
|
720 |
} else if (VM_Exit::vm_exited()) { |
|
721 |
st->print(" (shutting down)"); |
|
722 |
} else { |
|
723 |
st->print(" (normal execution)"); |
|
724 |
} |
|
725 |
st->cr(); |
|
726 |
st->cr(); |
|
727 |
} |
|
728 |
||
38215 | 729 |
STEP("printing owned locks on error") |
1 | 730 |
|
731 |
// mutexes/monitors that currently have an owner |
|
732 |
if (_verbose) { |
|
733 |
print_owned_locks_on_error(st); |
|
734 |
st->cr(); |
|
735 |
} |
|
736 |
||
38215 | 737 |
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
|
738 |
|
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
739 |
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
|
740 |
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
|
741 |
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
|
742 |
st->cr(); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
743 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
744 |
|
38215 | 745 |
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
|
746 |
|
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
747 |
if (_verbose && UseCompressedOops) { |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
748 |
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
|
749 |
if (UseCompressedClassPointers) { |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
750 |
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
|
751 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
752 |
st->cr(); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
753 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
30773
diff
changeset
|
754 |
|
38215 | 755 |
STEP("printing heap information") |
1 | 756 |
|
757 |
if (_verbose && Universe::is_fully_initialized()) { |
|
16685
41c34debcde0
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
15602
diff
changeset
|
758 |
Universe::heap()->print_on_error(st); |
12268 | 759 |
st->cr(); |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33131
diff
changeset
|
760 |
st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page())); |
12268 | 761 |
st->cr(); |
1 | 762 |
} |
763 |
||
38215 | 764 |
STEP("printing code cache information") |
7108 | 765 |
|
766 |
if (_verbose && Universe::is_fully_initialized()) { |
|
767 |
// print code cache information before vm abort |
|
15201
f3d755b11424
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
14477
diff
changeset
|
768 |
CodeCache::print_summary(st); |
7108 | 769 |
st->cr(); |
770 |
} |
|
771 |
||
38215 | 772 |
STEP("printing ring buffers") |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
773 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
774 |
if (_verbose) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
775 |
Events::print_all(st); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
776 |
st->cr(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
777 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11483
diff
changeset
|
778 |
|
38215 | 779 |
STEP("printing dynamic libraries") |
1 | 780 |
|
781 |
if (_verbose) { |
|
782 |
// dynamic libraries, or memory map |
|
783 |
os::print_dll_info(st); |
|
784 |
st->cr(); |
|
785 |
} |
|
786 |
||
38215 | 787 |
STEP("printing VM options") |
1 | 788 |
|
789 |
if (_verbose) { |
|
790 |
// VM options |
|
791 |
Arguments::print_on(st); |
|
792 |
st->cr(); |
|
793 |
} |
|
794 |
||
38215 | 795 |
STEP("printing warning if internal testing API used") |
12095 | 796 |
|
797 |
if (WhiteBox::used()) { |
|
798 |
st->print_cr("Unsupported internal testing APIs have been used."); |
|
799 |
st->cr(); |
|
800 |
} |
|
801 |
||
38215 | 802 |
STEP("printing log configuration") |
37994
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
803 |
if (_verbose){ |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
804 |
st->print_cr("Logging:"); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
805 |
LogConfiguration::describe_current_configuration(st); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
806 |
st->cr(); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
807 |
} |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
808 |
|
38215 | 809 |
STEP("printing all environment variables") |
1 | 810 |
|
811 |
if (_verbose) { |
|
30125 | 812 |
os::print_environment_variables(st, env_list); |
1 | 813 |
st->cr(); |
814 |
} |
|
815 |
||
38215 | 816 |
STEP("printing signal handlers") |
1 | 817 |
|
818 |
if (_verbose) { |
|
819 |
os::print_signal_handlers(st, buf, sizeof(buf)); |
|
820 |
st->cr(); |
|
821 |
} |
|
822 |
||
38215 | 823 |
STEP("Native Memory Tracking") |
25946 | 824 |
if (_verbose) { |
27162
0a4a7276949b
8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
26821
diff
changeset
|
825 |
MemTracker::error_report(st); |
25946 | 826 |
} |
827 |
||
38215 | 828 |
STEP("printing system") |
1 | 829 |
|
830 |
if (_verbose) { |
|
831 |
st->cr(); |
|
832 |
st->print_cr("--------------- S Y S T E M ---------------"); |
|
833 |
st->cr(); |
|
834 |
} |
|
835 |
||
38215 | 836 |
STEP("printing OS information") |
1 | 837 |
|
838 |
if (_verbose) { |
|
839 |
os::print_os_info(st); |
|
840 |
st->cr(); |
|
841 |
} |
|
842 |
||
38215 | 843 |
STEP("printing CPU info") |
1 | 844 |
if (_verbose) { |
31356
55ee785c49c5
8085865: hs_err improvement: Printing /proc/cpuinfo makes too long hs_err files
coleenp
parents:
31335
diff
changeset
|
845 |
os::print_cpu_info(st, buf, sizeof(buf)); |
1 | 846 |
st->cr(); |
847 |
} |
|
848 |
||
38215 | 849 |
STEP("printing memory info") |
1 | 850 |
|
851 |
if (_verbose) { |
|
852 |
os::print_memory_info(st); |
|
853 |
st->cr(); |
|
854 |
} |
|
855 |
||
38215 | 856 |
STEP("printing internal vm info") |
1 | 857 |
|
858 |
if (_verbose) { |
|
859 |
st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); |
|
860 |
st->cr(); |
|
861 |
} |
|
862 |
||
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
863 |
// print a defined marker to show that error handling finished correctly. |
38215 | 864 |
STEP("printing end marker") |
28943
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
865 |
|
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
866 |
if (_verbose) { |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
867 |
st->print_cr("END."); |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
868 |
} |
679546f0cc1f
8065895: Synchronous signals during error reporting may terminate or hang VM process
dholmes
parents:
28513
diff
changeset
|
869 |
|
1 | 870 |
END |
871 |
||
872 |
# undef BEGIN |
|
873 |
# undef STEP |
|
874 |
# undef END |
|
875 |
} |
|
876 |
||
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
877 |
// 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
|
878 |
// 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
|
879 |
// 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
|
880 |
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
|
881 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
882 |
char buf[O_BUFLEN]; |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
883 |
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
|
884 |
|
38215 | 885 |
// STEP("printing summary") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
886 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
887 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
888 |
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
|
889 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
890 |
|
38215 | 891 |
// STEP("printing VM option summary") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
892 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
893 |
// VM options |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
894 |
Arguments::print_summary_on(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
895 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
896 |
|
38215 | 897 |
// 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
|
898 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
899 |
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
|
900 |
|
38215 | 901 |
// STEP("printing date and time") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
902 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
903 |
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
|
904 |
|
38215 | 905 |
// Skip: STEP("printing thread") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
906 |
|
38215 | 907 |
// STEP("printing process") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
908 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
909 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
910 |
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
|
911 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
912 |
|
38215 | 913 |
// 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
|
914 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
915 |
if (Exceptions::has_exception_counts()) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
916 |
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
|
917 |
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
|
918 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
919 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
920 |
|
38215 | 921 |
// STEP("printing compressed oops mode") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
922 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
923 |
if (UseCompressedOops) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
924 |
Universe::print_compressed_oops_mode(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
925 |
if (UseCompressedClassPointers) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
926 |
Metaspace::print_compressed_class_space(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
927 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
928 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
929 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
930 |
|
38215 | 931 |
// STEP("printing heap information") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
932 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
933 |
if (Universe::is_fully_initialized()) { |
39401 | 934 |
MutexLocker hl(Heap_lock); |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
935 |
Universe::heap()->print_on_error(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
936 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
937 |
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
|
938 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
939 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
940 |
|
38215 | 941 |
// STEP("printing code cache information") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
942 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
943 |
if (Universe::is_fully_initialized()) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
944 |
// 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
|
945 |
CodeCache::print_summary(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
946 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
947 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
948 |
|
38215 | 949 |
// STEP("printing ring buffers") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
950 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
951 |
Events::print_all(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
952 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
953 |
|
38215 | 954 |
// STEP("printing dynamic libraries") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
955 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
956 |
// dynamic libraries, or memory map |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
957 |
os::print_dll_info(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
958 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
959 |
|
38215 | 960 |
// STEP("printing VM options") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
961 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
962 |
// VM options |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
963 |
Arguments::print_on(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
964 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
965 |
|
38215 | 966 |
// 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
|
967 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
968 |
if (WhiteBox::used()) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
969 |
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
|
970 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
971 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
972 |
|
38215 | 973 |
// STEP("printing log configuration") |
37994
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
974 |
st->print_cr("Logging:"); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
975 |
LogConfiguration::describe(st); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
976 |
st->cr(); |
1a816b464178
8151526: Print -Xlog configuration in the hs_err_pid file
mockner
parents:
37466
diff
changeset
|
977 |
|
38215 | 978 |
// STEP("printing all environment variables") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
979 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
980 |
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
|
981 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
982 |
|
38215 | 983 |
// STEP("printing signal handlers") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
984 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
985 |
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
|
986 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
987 |
|
38215 | 988 |
// STEP("Native Memory Tracking") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
989 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
990 |
MemTracker::error_report(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
991 |
|
38215 | 992 |
// STEP("printing system") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
993 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
994 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
995 |
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
|
996 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
997 |
|
38215 | 998 |
// STEP("printing OS information") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
999 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1000 |
os::print_os_info(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1001 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1002 |
|
38215 | 1003 |
// STEP("printing CPU info") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1004 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1005 |
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
|
1006 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1007 |
|
38215 | 1008 |
// STEP("printing memory info") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1009 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1010 |
os::print_memory_info(st); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1011 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1012 |
|
38215 | 1013 |
// STEP("printing internal vm info") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1014 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1015 |
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
|
1016 |
st->cr(); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1017 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1018 |
// print a defined marker to show that error handling finished correctly. |
38215 | 1019 |
// STEP("printing end marker") |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1020 |
|
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33198
diff
changeset
|
1021 |
st->print_cr("END."); |
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 |
|
33131
a8ad9de9e5a4
8138832: CreateCoredumpOnCrash on linux ARM causes assert message to be repeated.
david
parents:
33105
diff
changeset
|
1024 |
volatile intptr_t VMError::first_error_tid = -1; |
1 | 1025 |
|
18487
270ef05ebce8
7060111: race condition in VMError::report_and_die()
fparain
parents:
17134
diff
changeset
|
1026 |
// An error could happen before tty is initialized or after it has been |
35869 | 1027 |
// destroyed. |
1028 |
// Please note: to prevent large stack allocations, the log- and |
|
1029 |
// output-stream use a global scratch buffer for format printing. |
|
1030 |
// (see VmError::report_and_die(). Access to those streams is synchronized |
|
1031 |
// in VmError::report_and_die() - there is only one reporting thread at |
|
1032 |
// any given time. |
|
18487
270ef05ebce8
7060111: race condition in VMError::report_and_die()
fparain
parents:
17134
diff
changeset
|
1033 |
fdStream VMError::out(defaultStream::output_fd()); |
270ef05ebce8
7060111: race condition in VMError::report_and_die()
fparain
parents:
17134
diff
changeset
|
1034 |
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
|
1035 |
|
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1036 |
/** 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
|
1037 |
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
|
1038 |
int fd = -1; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1039 |
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
|
1040 |
// 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
|
1041 |
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
|
1042 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1043 |
return fd; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1044 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1045 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1046 |
/** |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1047 |
* 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
|
1048 |
* 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
|
1049 |
* permissions. |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1050 |
*/ |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1051 |
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
|
1052 |
int fd = -1; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1053 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1054 |
// 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
|
1055 |
if (pattern != NULL) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1056 |
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
|
1057 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1058 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1059 |
// 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
|
1060 |
// 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
|
1061 |
if (fd == -1) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1062 |
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
|
1063 |
if (cwd != NULL) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1064 |
size_t pos = strlen(cwd); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1065 |
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
|
1066 |
pos += fsep_len; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1067 |
if (fsep_len > 0) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1068 |
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
|
1069 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1070 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1071 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1072 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1073 |
// try temp directory if it exists. |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1074 |
if (fd == -1) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1075 |
const char* tmpdir = os::get_temp_directory(); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1076 |
if (tmpdir != NULL && strlen(tmpdir) > 0) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1077 |
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
|
1078 |
if (pos > 0) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1079 |
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
|
1080 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1081 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1082 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1083 |
|
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1084 |
return fd; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1085 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1086 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1087 |
int VMError::_id; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1088 |
const char* VMError::_message; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1089 |
char VMError::_detail_msg[1024]; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1090 |
Thread* VMError::_thread; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1091 |
address VMError::_pc; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1092 |
void* VMError::_siginfo; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1093 |
void* VMError::_context; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1094 |
const char* VMError::_filename; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1095 |
int VMError::_lineno; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1096 |
size_t VMError::_size; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1097 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1098 |
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
|
1099 |
void* context, const char* detail_fmt, ...) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1100 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1101 |
va_list detail_args; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1102 |
va_start(detail_args, detail_fmt); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1103 |
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
|
1104 |
va_end(detail_args); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1105 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1106 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1107 |
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
|
1108 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1109 |
report_and_die(thread, sig, pc, siginfo, context, "%s", ""); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1110 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1111 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1112 |
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
|
1113 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1114 |
va_list detail_args; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1115 |
va_start(detail_args, detail_fmt); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1116 |
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
|
1117 |
va_end(detail_args); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1118 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1119 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1120 |
void VMError::report_and_die(const char* message) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1121 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1122 |
report_and_die(message, "%s", ""); |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1123 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1124 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1125 |
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
|
1126 |
const char* detail_fmt, va_list detail_args) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1127 |
{ |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1128 |
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
|
1129 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1130 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1131 |
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
|
1132 |
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
|
1133 |
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
|
1134 |
} |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1135 |
|
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1136 |
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
|
1137 |
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
|
1138 |
int lineno, size_t size) |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1139 |
{ |
1 | 1140 |
// Don't allocate large buffer on stack |
1141 |
static char buffer[O_BUFLEN]; |
|
35869 | 1142 |
out.set_scratch_buffer(buffer, sizeof(buffer)); |
1143 |
log.set_scratch_buffer(buffer, sizeof(buffer)); |
|
1 | 1144 |
|
1145 |
// How many errors occurred in error handler when reporting first_error. |
|
1146 |
static int recursive_error_count; |
|
1147 |
||
1148 |
// We will first print a brief message to standard out (verbose = false), |
|
1149 |
// then save detailed information in log file (verbose = true). |
|
1150 |
static bool out_done = false; // done printing to standard out |
|
1151 |
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
|
1152 |
static bool transmit_report_done = false; // done error reporting |
1 | 1153 |
|
1154 |
if (SuppressFatalErrorMessage) { |
|
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
1155 |
os::abort(CreateCoredumpOnCrash); |
1 | 1156 |
} |
33131
a8ad9de9e5a4
8138832: CreateCoredumpOnCrash on linux ARM causes assert message to be repeated.
david
parents:
33105
diff
changeset
|
1157 |
intptr_t mytid = os::current_thread_id(); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1158 |
if (first_error_tid == -1 && |
33131
a8ad9de9e5a4
8138832: CreateCoredumpOnCrash on linux ARM causes assert message to be repeated.
david
parents:
33105
diff
changeset
|
1159 |
Atomic::cmpxchg_ptr(mytid, &first_error_tid, -1) == -1) { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1160 |
|
36320
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1161 |
// Initialize time stamps to use the same base. |
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1162 |
out.time_stamp().update_to(1); |
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1163 |
log.time_stamp().update_to(1); |
3d35d1e1dfde
8150441: CompileTask::print_impl() is broken after JDK-8146905
thartmann
parents:
35913
diff
changeset
|
1164 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1165 |
_id = id; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1166 |
_message = message; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1167 |
_thread = thread; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1168 |
_pc = pc; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1169 |
_siginfo = siginfo; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1170 |
_context = context; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1171 |
_filename = filename; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1172 |
_lineno = lineno; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1173 |
_size = size; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1174 |
jio_vsnprintf(_detail_msg, sizeof(_detail_msg), detail_fmt, detail_args); |
1 | 1175 |
|
1176 |
// first time |
|
1177 |
set_error_reported(); |
|
1178 |
||
8476
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
1179 |
if (ShowMessageBoxOnError || PauseAtExit) { |
1 | 1180 |
show_message_box(buffer, sizeof(buffer)); |
1181 |
||
1182 |
// User has asked JVM to abort. Reset ShowMessageBoxOnError so the |
|
1183 |
// WatcherThread can kill JVM if the error handler hangs. |
|
1184 |
ShowMessageBoxOnError = false; |
|
1185 |
} |
|
1186 |
||
30240
a7ba42fa1df6
8074354: Make CreateMinidumpOnCrash a new name and available on all platforms
minqi
parents:
30125
diff
changeset
|
1187 |
os::check_dump_limit(buffer, sizeof(buffer)); |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
8114
diff
changeset
|
1188 |
|
1 | 1189 |
// reset signal handlers or exception filter; make sure recursive crashes |
1190 |
// are handled properly. |
|
1191 |
reset_signal_handlers(); |
|
1192 |
||
39274
940f0e8e9ec2
8158033: Notify_tracing() misplaced for intended purpose
mgronlun
parents:
38215
diff
changeset
|
1193 |
TRACE_VM_ERROR(); |
940f0e8e9ec2
8158033: Notify_tracing() misplaced for intended purpose
mgronlun
parents:
38215
diff
changeset
|
1194 |
|
1 | 1195 |
} else { |
1887
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1196 |
// 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
|
1197 |
// 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
|
1198 |
// to be reported. |
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1199 |
if (UseOSErrorReporting && log_done) return; |
0ed88ac17540
4997835: RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError
coleenp
parents:
1660
diff
changeset
|
1200 |
|
1 | 1201 |
// This is not the first error, see if it happened in a different thread |
1202 |
// or in the same thread during error reporting. |
|
1203 |
if (first_error_tid != mytid) { |
|
18684 | 1204 |
char msgbuf[64]; |
1205 |
jio_snprintf(msgbuf, sizeof(msgbuf), |
|
33131
a8ad9de9e5a4
8138832: CreateCoredumpOnCrash on linux ARM causes assert message to be repeated.
david
parents:
33105
diff
changeset
|
1206 |
"[thread " INTX_FORMAT " also had an error]", |
1 | 1207 |
mytid); |
18684 | 1208 |
out.print_raw_cr(msgbuf); |
1 | 1209 |
|
1210 |
// error reporting is not MT-safe, block current thread |
|
1211 |
os::infinite_sleep(); |
|
1212 |
||
1213 |
} else { |
|
1214 |
if (recursive_error_count++ > 30) { |
|
1215 |
out.print_raw_cr("[Too many errors, abort]"); |
|
1216 |
os::die(); |
|
1217 |
} |
|
1218 |
||
1219 |
jio_snprintf(buffer, sizeof(buffer), |
|
38215 | 1220 |
"[error occurred during error reporting (%s), id 0x%x]", |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1221 |
_current_step_info, _id); |
1 | 1222 |
if (log.is_open()) { |
1223 |
log.cr(); |
|
1224 |
log.print_raw_cr(buffer); |
|
1225 |
log.cr(); |
|
1226 |
} else { |
|
1227 |
out.cr(); |
|
1228 |
out.print_raw_cr(buffer); |
|
1229 |
out.cr(); |
|
1230 |
} |
|
1231 |
} |
|
1232 |
} |
|
1233 |
||
1234 |
// print to screen |
|
1235 |
if (!out_done) { |
|
35869 | 1236 |
report(&out, false); |
1 | 1237 |
|
1238 |
out_done = true; |
|
1239 |
||
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1240 |
_current_step = 0; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1241 |
_current_step_info = ""; |
1 | 1242 |
} |
1243 |
||
1244 |
// print to error log file |
|
1245 |
if (!log_done) { |
|
1246 |
// see if log file is already open |
|
1247 |
if (!log.is_open()) { |
|
1248 |
// open log file |
|
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1249 |
int fd = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer)); |
1 | 1250 |
if (fd != -1) { |
1251 |
out.print_raw("# An error report file with more information is saved as:\n# "); |
|
1252 |
out.print_raw_cr(buffer); |
|
1253 |
||
1254 |
log.set_fd(fd); |
|
1255 |
} else { |
|
1256 |
out.print_raw_cr("# Can not save log file, dump to screen.."); |
|
1257 |
log.set_fd(defaultStream::output_fd()); |
|
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1258 |
/* Error reporting currently needs dumpfile. |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1259 |
* Maybe implement direct streaming in the future.*/ |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1260 |
transmit_report_done = true; |
1 | 1261 |
} |
1262 |
} |
|
1263 |
||
35869 | 1264 |
report(&log, true); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1265 |
_current_step = 0; |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1266 |
_current_step_info = ""; |
1 | 1267 |
|
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1268 |
// 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
|
1269 |
if (!transmit_report_done && should_report_bug(_id)) { |
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1270 |
transmit_report_done = true; |
27471 | 1271 |
const int fd2 = ::dup(log.fd()); |
1272 |
FILE* const hs_err = ::fdopen(fd2, "r"); |
|
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1273 |
if (NULL != hs_err) { |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1274 |
ErrorReporter er; |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1275 |
er.call(hs_err, buffer, O_BUFLEN); |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1276 |
} |
27471 | 1277 |
::fclose(hs_err); |
8114
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1278 |
} |
340b5b8b544b
7003401: Implement VM error-reporting functionality on erroneous termination
kamg
parents:
7901
diff
changeset
|
1279 |
|
1 | 1280 |
if (log.fd() != defaultStream::output_fd()) { |
1281 |
close(log.fd()); |
|
1282 |
} |
|
1283 |
||
1284 |
log.set_fd(-1); |
|
1285 |
log_done = true; |
|
1286 |
} |
|
1287 |
||
22243 | 1288 |
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
|
1289 |
if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1290 |
skip_replay = true; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1291 |
ciEnv* env = ciEnv::current(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1292 |
if (env != NULL) { |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1293 |
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
|
1294 |
if (fd != -1) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1295 |
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
|
1296 |
if (replay_data_file != NULL) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1297 |
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
|
1298 |
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
|
1299 |
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
|
1300 |
out.print_raw_cr(buffer); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1301 |
} else { |
37113 | 1302 |
int e = errno; |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1303 |
out.print_raw("#\n# Can't open file to dump replay data. Error: "); |
37113 | 1304 |
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
|
1305 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
16685
diff
changeset
|
1306 |
} |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1307 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1308 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14289
diff
changeset
|
1309 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1310 |
static bool skip_bug_url = !should_report_bug(_id); |
1 | 1311 |
if (!skip_bug_url) { |
1312 |
skip_bug_url = true; |
|
1313 |
||
1314 |
out.print_raw_cr("#"); |
|
1315 |
print_bug_submit_message(&out, _thread); |
|
1316 |
} |
|
1317 |
||
35568
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1318 |
static bool skip_OnError = false; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1319 |
if (!skip_OnError && OnError && OnError[0]) { |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1320 |
skip_OnError = true; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1321 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1322 |
// Flush output and finish logs before running OnError commands. |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1323 |
ostream_abort(); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1324 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1325 |
out.print_raw_cr("#"); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1326 |
out.print_raw ("# -XX:OnError=\""); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1327 |
out.print_raw (OnError); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1328 |
out.print_raw_cr("\""); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1329 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1330 |
char* cmd; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1331 |
const char* ptr = OnError; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1332 |
while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1333 |
out.print_raw ("# Executing "); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1334 |
#if defined(LINUX) || defined(_ALLBSD_SOURCE) |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1335 |
out.print_raw ("/bin/sh -c "); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1336 |
#elif defined(SOLARIS) |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1337 |
out.print_raw ("/usr/bin/sh -c "); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1338 |
#endif |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1339 |
out.print_raw ("\""); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1340 |
out.print_raw (cmd); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1341 |
out.print_raw_cr("\" ..."); |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1342 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1343 |
if (os::fork_and_exec(cmd) < 0) { |
37113 | 1344 |
out.print_cr("os::fork_and_exec failed: %s (%s=%d)", |
1345 |
os::strerror(errno), os::errno_name(errno), errno); |
|
35568
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1346 |
} |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1347 |
} |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1348 |
|
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1349 |
// done with OnError |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1350 |
OnError = NULL; |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1351 |
} |
8dfb205a2886
6985422: flush the output streams before OnError commands
vlivanov
parents:
35176
diff
changeset
|
1352 |
|
1 | 1353 |
if (!UseOSErrorReporting) { |
1354 |
// os::abort() will call abort hooks, try it first. |
|
1355 |
static bool skip_os_abort = false; |
|
1356 |
if (!skip_os_abort) { |
|
1357 |
skip_os_abort = true; |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1358 |
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
|
1359 |
os::abort(dump_core && CreateCoredumpOnCrash, _siginfo, _context); |
1 | 1360 |
} |
1361 |
||
1362 |
// if os::abort() doesn't abort, try os::die(); |
|
1363 |
os::die(); |
|
1364 |
} |
|
1365 |
} |
|
1366 |
||
1367 |
/* |
|
1368 |
* OnOutOfMemoryError scripts/commands executed while VM is a safepoint - this |
|
1369 |
* ensures utilities such as jmap can observe the process is a consistent state. |
|
1370 |
*/ |
|
1371 |
class VM_ReportJavaOutOfMemory : public VM_Operation { |
|
1372 |
private: |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1373 |
const char* _message; |
1 | 1374 |
public: |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1375 |
VM_ReportJavaOutOfMemory(const char* message) { _message = message; } |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1376 |
VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; } |
1 | 1377 |
void doit(); |
1378 |
}; |
|
1379 |
||
1380 |
void VM_ReportJavaOutOfMemory::doit() { |
|
1381 |
// Don't allocate large buffer on stack |
|
1382 |
static char buffer[O_BUFLEN]; |
|
1383 |
||
1384 |
tty->print_cr("#"); |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1385 |
tty->print_cr("# java.lang.OutOfMemoryError: %s", _message); |
1 | 1386 |
tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError); |
1387 |
||
1388 |
// make heap parsability |
|
1389 |
Universe::heap()->ensure_parsability(false); // no need to retire TLABs |
|
1390 |
||
1391 |
char* cmd; |
|
1392 |
const char* ptr = OnOutOfMemoryError; |
|
1393 |
while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ |
|
1394 |
tty->print("# Executing "); |
|
1395 |
#if defined(LINUX) |
|
1396 |
tty->print ("/bin/sh -c "); |
|
1397 |
#elif defined(SOLARIS) |
|
1398 |
tty->print ("/usr/bin/sh -c "); |
|
1399 |
#endif |
|
1400 |
tty->print_cr("\"%s\"...", cmd); |
|
1401 |
||
30745
8ebe80838174
8078470: [Linux] Replace syscall use in os::fork_and_exec with glibc fork() and execve()
dholmes
parents:
30622
diff
changeset
|
1402 |
if (os::fork_and_exec(cmd) < 0) { |
37113 | 1403 |
tty->print_cr("os::fork_and_exec failed: %s (%s=%d)", |
1404 |
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
|
1405 |
} |
1 | 1406 |
} |
1407 |
} |
|
1408 |
||
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1409 |
void VMError::report_java_out_of_memory(const char* message) { |
1 | 1410 |
if (OnOutOfMemoryError && OnOutOfMemoryError[0]) { |
1411 |
MutexLocker ml(Heap_lock); |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32583
diff
changeset
|
1412 |
VM_ReportJavaOutOfMemory op(message); |
1 | 1413 |
VMThread::execute(&op); |
1414 |
} |
|
1415 |
} |
|
34305
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1416 |
|
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1417 |
void VMError::show_message_box(char *buf, int buflen) { |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1418 |
bool yes; |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1419 |
do { |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1420 |
error_string(buf, buflen); |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1421 |
yes = os::start_debugging(buf,buflen); |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1422 |
} while (yes); |
e399e6b44631
8136978: Much nearly duplicated code for vmError support
sebastian
parents:
34139
diff
changeset
|
1423 |
} |