1.1 --- a/src/share/vm/utilities/vmError.cpp Tue Dec 28 09:54:09 2010 -0500 1.2 +++ b/src/share/vm/utilities/vmError.cpp Mon Jan 03 14:09:11 2011 -0500 1.3 @@ -67,7 +67,7 @@ 1.4 // threads are blocked forever inside report_and_die(). 1.5 1.6 // Constructor for crashes 1.7 -VMError::VMError(Thread* thread, int sig, address pc, void* siginfo, void* context) { 1.8 +VMError::VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) { 1.9 _thread = thread; 1.10 _id = sig; 1.11 _pc = pc; 1.12 @@ -322,29 +322,51 @@ 1.13 1.14 STEP(10, "(printing fatal error message)") 1.15 1.16 - st->print_cr("#"); 1.17 - st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); 1.18 + st->print_cr("#"); 1.19 + if (should_report_bug(_id)) { 1.20 + st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); 1.21 + } else { 1.22 + st->print_cr("# There is insufficient memory for the Java " 1.23 + "Runtime Environment to continue."); 1.24 + } 1.25 1.26 STEP(15, "(printing type of error)") 1.27 1.28 switch(_id) { 1.29 case oom_error: 1.30 - st->print_cr("#"); 1.31 - st->print("# java.lang.OutOfMemoryError: "); 1.32 if (_size) { 1.33 - st->print("requested "); 1.34 - sprintf(buf,SIZE_FORMAT,_size); 1.35 + st->print("# Native memory allocation (malloc) failed to allocate "); 1.36 + jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); 1.37 st->print(buf); 1.38 st->print(" bytes"); 1.39 if (_message != NULL) { 1.40 st->print(" for "); 1.41 st->print(_message); 1.42 } 1.43 - st->print_cr(". Out of swap space?"); 1.44 + st->cr(); 1.45 } else { 1.46 if (_message != NULL) 1.47 + st->print("# "); 1.48 st->print_cr(_message); 1.49 } 1.50 + // In error file give some solutions 1.51 + if (_verbose) { 1.52 + st->print_cr("# Possible reasons:"); 1.53 + st->print_cr("# The system is out of physical RAM or swap space"); 1.54 + st->print_cr("# In 32 bit mode, the process size limit was hit"); 1.55 + st->print_cr("# Possible solutions:"); 1.56 + st->print_cr("# Reduce memory load on the system"); 1.57 + st->print_cr("# Increase physical memory or swap space"); 1.58 + st->print_cr("# Check if swap backing store is full"); 1.59 + st->print_cr("# Use 64 bit Java on a 64 bit OS"); 1.60 + st->print_cr("# Decrease Java heap size (-Xmx/-Xms)"); 1.61 + st->print_cr("# Decrease number of Java threads"); 1.62 + st->print_cr("# Decrease Java thread stack sizes (-Xss)"); 1.63 + st->print_cr("# Set larger code cache with -XX:ReservedCodeCacheSize="); 1.64 + st->print_cr("# This output file may be truncated or incomplete."); 1.65 + } else { 1.66 + return; // that's enough for the screen 1.67 + } 1.68 break; 1.69 case internal_error: 1.70 default: 1.71 @@ -361,7 +383,11 @@ 1.72 st->print(" (0x%x)", _id); // signal number 1.73 st->print(" at pc=" PTR_FORMAT, _pc); 1.74 } else { 1.75 - st->print("Internal Error"); 1.76 + if (should_report_bug(_id)) { 1.77 + st->print("Internal Error"); 1.78 + } else { 1.79 + st->print("Out of Memory Error"); 1.80 + } 1.81 if (_filename != NULL && _lineno > 0) { 1.82 #ifdef PRODUCT 1.83 // In product mode chop off pathname? 1.84 @@ -393,12 +419,14 @@ 1.85 1.86 STEP(40, "(printing error message)") 1.87 1.88 - // error message 1.89 - if (_detail_msg) { 1.90 - st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg); 1.91 - } else if (_message) { 1.92 - st->print_cr("# Error: %s", _message); 1.93 - } 1.94 + if (should_report_bug(_id)) { // already printed the message. 1.95 + // error message 1.96 + if (_detail_msg) { 1.97 + st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg); 1.98 + } else if (_message) { 1.99 + st->print_cr("# Error: %s", _message); 1.100 + } 1.101 + } 1.102 1.103 STEP(50, "(printing Java version string)") 1.104 1.105 @@ -428,7 +456,9 @@ 1.106 1.107 STEP(65, "(printing bug submit message)") 1.108 1.109 - if (_verbose) print_bug_submit_message(st, _thread); 1.110 + if (should_report_bug(_id) && _verbose) { 1.111 + print_bug_submit_message(st, _thread); 1.112 + } 1.113 1.114 STEP(70, "(printing thread)" ) 1.115 1.116 @@ -906,7 +936,7 @@ 1.117 OnError = NULL; 1.118 } 1.119 1.120 - static bool skip_bug_url = false; 1.121 + static bool skip_bug_url = !should_report_bug(first_error->_id); 1.122 if (!skip_bug_url) { 1.123 skip_bug_url = true; 1.124 1.125 @@ -919,7 +949,8 @@ 1.126 static bool skip_os_abort = false; 1.127 if (!skip_os_abort) { 1.128 skip_os_abort = true; 1.129 - os::abort(); 1.130 + bool dump_core = should_report_bug(first_error->_id); 1.131 + os::abort(dump_core); 1.132 } 1.133 1.134 // if os::abort() doesn't abort, try os::die();