--- a/hotspot/src/share/vm/utilities/vmError.cpp Sun Oct 11 16:19:25 2009 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Thu Apr 22 13:23:15 2010 -0700
@@ -65,7 +65,8 @@
_current_step = 0;
_current_step_info = NULL;
- _message = "";
+ _message = NULL;
+ _detail_msg = NULL;
_filename = NULL;
_lineno = 0;
@@ -73,31 +74,36 @@
}
// Constructor for internal errors
-VMError::VMError(Thread* thread, const char* message, const char* filename, int lineno) {
+VMError::VMError(Thread* thread, const char* filename, int lineno,
+ const char* message, const char * detail_msg)
+{
+ _thread = thread;
+ _id = internal_error; // Value that's not an OS exception/signal
+ _filename = filename;
+ _lineno = lineno;
+ _message = message;
+ _detail_msg = detail_msg;
+
+ _verbose = false;
+ _current_step = 0;
+ _current_step_info = NULL;
+
+ _pc = NULL;
+ _siginfo = NULL;
+ _context = NULL;
+
+ _size = 0;
+}
+
+// Constructor for OOM errors
+VMError::VMError(Thread* thread, const char* filename, int lineno, size_t size,
+ const char* message) {
_thread = thread;
- _id = internal_error; // set it to a value that's not an OS exception/signal
+ _id = oom_error; // Value that's not an OS exception/signal
_filename = filename;
_lineno = lineno;
_message = message;
-
- _verbose = false;
- _current_step = 0;
- _current_step_info = NULL;
-
- _pc = NULL;
- _siginfo = NULL;
- _context = NULL;
-
- _size = 0;
-}
-
-// Constructor for OOM errors
-VMError::VMError(Thread* thread, size_t size, const char* message, const char* filename, int lineno) {
- _thread = thread;
- _id = oom_error; // set it to a value that's not an OS exception/signal
- _filename = filename;
- _lineno = lineno;
- _message = message;
+ _detail_msg = NULL;
_verbose = false;
_current_step = 0;
@@ -114,10 +120,11 @@
// Constructor for non-fatal errors
VMError::VMError(const char* message) {
_thread = NULL;
- _id = internal_error; // set it to a value that's not an OS exception/signal
+ _id = internal_error; // Value that's not an OS exception/signal
_filename = NULL;
_lineno = 0;
_message = message;
+ _detail_msg = NULL;
_verbose = false;
_current_step = 0;
@@ -191,22 +198,27 @@
"%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT,
signame, _id, _pc,
os::current_process_id(), os::current_thread_id());
+ } else if (_filename != NULL && _lineno > 0) {
+ // skip directory names
+ char separator = os::file_separator()[0];
+ const char *p = strrchr(_filename, separator);
+ int n = jio_snprintf(buf, buflen,
+ "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT,
+ p ? p + 1 : _filename, _lineno,
+ os::current_process_id(), os::current_thread_id());
+ if (n >= 0 && n < buflen && _message) {
+ if (_detail_msg) {
+ jio_snprintf(buf + n, buflen - n, "%s%s: %s",
+ os::line_separator(), _message, _detail_msg);
+ } else {
+ jio_snprintf(buf + n, buflen - n, "%sError: %s",
+ os::line_separator(), _message);
+ }
+ }
} else {
- if (_filename != NULL && _lineno > 0) {
- // skip directory names
- char separator = os::file_separator()[0];
- const char *p = strrchr(_filename, separator);
-
- jio_snprintf(buf, buflen,
- "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT " \nError: %s",
- p ? p + 1 : _filename, _lineno,
- os::current_process_id(), os::current_thread_id(),
- _message ? _message : "");
- } else {
- jio_snprintf(buf, buflen,
- "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT,
- _id, os::current_process_id(), os::current_thread_id());
- }
+ jio_snprintf(buf, buflen,
+ "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT,
+ _id, os::current_process_id(), os::current_thread_id());
}
return buf;
@@ -369,7 +381,9 @@
STEP(40, "(printing error message)")
// error message
- if (_message && _message[0] != '\0') {
+ if (_detail_msg) {
+ st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg);
+ } else if (_message) {
st->print_cr("# Error: %s", _message);
}