8136577: Make AbortVMOnException available in product builds

Reviewed-by: coleenp
This commit is contained in:
Poonam Bajaj 2015-10-14 15:36:41 -07:00
parent df9b5759f7
commit a25ce80e78
9 changed files with 29 additions and 24 deletions

View file

@ -145,7 +145,7 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc
p2i(h_exception()), file, line, p2i(thread));
}
// for AbortVMOnException flag
NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));
Exceptions::debug_check_abort(h_exception, message);
// Check for special boot-strapping/vm-thread handling
if (special_exception(thread, file, line, h_exception)) {
@ -477,13 +477,12 @@ ExceptionMark::~ExceptionMark() {
// ----------------------------------------------------------------------------------------
#ifndef PRODUCT
// caller frees value_string if necessary
void Exceptions::debug_check_abort(const char *value_string, const char* message) {
if (AbortVMOnException != NULL && value_string != NULL &&
strstr(value_string, AbortVMOnException)) {
if (AbortVMOnExceptionMessage == NULL || message == NULL ||
strcmp(message, AbortVMOnExceptionMessage) == 0) {
if (AbortVMOnExceptionMessage == NULL || (message != NULL &&
strstr(message, AbortVMOnExceptionMessage))) {
fatal("Saw %s, aborting", value_string);
}
}
@ -491,14 +490,17 @@ void Exceptions::debug_check_abort(const char *value_string, const char* message
void Exceptions::debug_check_abort(Handle exception, const char* message) {
if (AbortVMOnException != NULL) {
ResourceMark rm;
if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) {
oop msg = java_lang_Throwable::message(exception);
if (msg != NULL) {
message = java_lang_String::as_utf8_string(msg);
}
}
debug_check_abort(InstanceKlass::cast(exception()->klass())->external_name(), message);
debug_check_abort_helper(exception, message);
}
}
#endif
void Exceptions::debug_check_abort_helper(Handle exception, const char* message) {
ResourceMark rm;
if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) {
oop msg = java_lang_Throwable::message(exception);
if (msg != NULL) {
message = java_lang_String::as_utf8_string(msg);
}
}
debug_check_abort(InstanceKlass::cast(exception()->klass())->external_name(), message);
}