annotate src/share/vm/utilities/exceptions.cpp @ 4834:74d14a44c398

Added tag jdk7u60-b01 for changeset 8fd0e931efa5
author asaha
date Wed, 27 Nov 2013 14:57:31 -0800
parents aa3d708d67c4
children de5e8c8a9b87
rev   line source
duke@0 1 /*
never@3157 2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #include "precompiled.hpp"
stefank@1879 26 #include "classfile/systemDictionary.hpp"
stefank@1879 27 #include "classfile/vmSymbols.hpp"
stefank@1879 28 #include "compiler/compileBroker.hpp"
stefank@1879 29 #include "oops/oop.inline.hpp"
stefank@1879 30 #include "runtime/init.hpp"
stefank@1879 31 #include "runtime/java.hpp"
stefank@1879 32 #include "runtime/javaCalls.hpp"
stefank@1879 33 #include "runtime/threadCritical.hpp"
stefank@1879 34 #include "utilities/events.hpp"
stefank@1879 35 #include "utilities/exceptions.hpp"
stefank@1879 36 #ifdef TARGET_OS_FAMILY_linux
stefank@1879 37 # include "thread_linux.inline.hpp"
stefank@1879 38 #endif
stefank@1879 39 #ifdef TARGET_OS_FAMILY_solaris
stefank@1879 40 # include "thread_solaris.inline.hpp"
stefank@1879 41 #endif
stefank@1879 42 #ifdef TARGET_OS_FAMILY_windows
stefank@1879 43 # include "thread_windows.inline.hpp"
stefank@1879 44 #endif
never@2796 45 #ifdef TARGET_OS_FAMILY_bsd
never@2796 46 # include "thread_bsd.inline.hpp"
never@2796 47 #endif
duke@0 48
duke@0 49
duke@0 50 // Implementation of ThreadShadow
duke@0 51 void check_ThreadShadow() {
duke@0 52 const ByteSize offset1 = byte_offset_of(ThreadShadow, _pending_exception);
duke@0 53 const ByteSize offset2 = Thread::pending_exception_offset();
duke@0 54 if (offset1 != offset2) fatal("ThreadShadow::_pending_exception is not positioned correctly");
duke@0 55 }
duke@0 56
duke@0 57
duke@0 58 void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) {
duke@0 59 assert(exception != NULL && exception->is_oop(), "invalid exception oop");
duke@0 60 _pending_exception = exception;
duke@0 61 _exception_file = file;
duke@0 62 _exception_line = line;
duke@0 63 }
duke@0 64
duke@0 65 void ThreadShadow::clear_pending_exception() {
duke@0 66 if (TraceClearedExceptions) {
duke@0 67 if (_pending_exception != NULL) {
duke@0 68 tty->print_cr("Thread::clear_pending_exception: cleared exception:");
duke@0 69 _pending_exception->print();
duke@0 70 }
duke@0 71 }
duke@0 72 _pending_exception = NULL;
duke@0 73 _exception_file = NULL;
duke@0 74 _exception_line = 0;
duke@0 75 }
duke@0 76 // Implementation of Exceptions
duke@0 77
duke@0 78 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Handle h_exception) {
duke@0 79 // bootstrapping check
duke@0 80 if (!Universe::is_fully_initialized()) {
duke@0 81 vm_exit_during_initialization(h_exception);
duke@0 82 ShouldNotReachHere();
duke@0 83 }
duke@0 84
coleenp@1787 85 #ifdef ASSERT
coleenp@1787 86 // Check for trying to throw stack overflow before initialization is complete
coleenp@1787 87 // to prevent infinite recursion trying to initialize stack overflow without
coleenp@1787 88 // adequate stack space.
coleenp@1787 89 // This can happen with stress testing a large value of StackShadowPages
coleenp@1787 90 if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
coleenp@1787 91 instanceKlass* ik = instanceKlass::cast(h_exception->klass());
coleenp@1787 92 assert(ik->is_initialized(),
coleenp@1787 93 "need to increase min_stack_allowed calculation");
coleenp@1787 94 }
coleenp@1787 95 #endif // ASSERT
coleenp@1787 96
duke@0 97 if (thread->is_VM_thread()
duke@0 98 || thread->is_Compiler_thread() ) {
duke@0 99 // We do not care what kind of exception we get for the vm-thread or a thread which
duke@0 100 // is compiling. We just install a dummy exception object
duke@0 101 thread->set_pending_exception(Universe::vm_exception(), file, line);
duke@0 102 return true;
duke@0 103 }
duke@0 104
duke@0 105 return false;
duke@0 106 }
duke@0 107
coleenp@2062 108 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Symbol* h_name, const char* message) {
duke@0 109 // bootstrapping check
duke@0 110 if (!Universe::is_fully_initialized()) {
coleenp@2062 111 if (h_name == NULL) {
duke@0 112 // atleast an informative message.
duke@0 113 vm_exit_during_initialization("Exception", message);
duke@0 114 } else {
duke@0 115 vm_exit_during_initialization(h_name, message);
duke@0 116 }
duke@0 117 ShouldNotReachHere();
duke@0 118 }
duke@0 119
duke@0 120 if (thread->is_VM_thread()
duke@0 121 || thread->is_Compiler_thread() ) {
duke@0 122 // We do not care what kind of exception we get for the vm-thread or a thread which
duke@0 123 // is compiling. We just install a dummy exception object
duke@0 124 thread->set_pending_exception(Universe::vm_exception(), file, line);
duke@0 125 return true;
duke@0 126 }
duke@0 127 return false;
duke@0 128 }
duke@0 129
duke@0 130 // This method should only be called from generated code,
duke@0 131 // therefore the exception oop should be in the oopmap.
duke@0 132 void Exceptions::_throw_oop(Thread* thread, const char* file, int line, oop exception) {
duke@0 133 assert(exception != NULL, "exception should not be NULL");
duke@0 134 Handle h_exception = Handle(thread, exception);
duke@0 135 _throw(thread, file, line, h_exception);
duke@0 136 }
duke@0 137
never@1011 138 void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
duke@0 139 assert(h_exception() != NULL, "exception should not be NULL");
duke@0 140
duke@0 141 // tracing (do this up front - so it works during boot strapping)
duke@0 142 if (TraceExceptions) {
duke@0 143 ttyLocker ttyl;
duke@0 144 ResourceMark rm;
never@1011 145 tty->print_cr("Exception <%s>%s%s (" INTPTR_FORMAT " ) \n"
never@1011 146 "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
never@1011 147 h_exception->print_value_string(),
never@1011 148 message ? ": " : "", message ? message : "",
never@1011 149 (address)h_exception(), file, line, thread);
duke@0 150 }
duke@0 151 // for AbortVMOnException flag
kvn@1604 152 NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));
duke@0 153
duke@0 154 // Check for special boot-strapping/vm-thread handling
duke@0 155 if (special_exception(thread, file, line, h_exception)) return;
duke@0 156
never@1142 157 assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");
duke@0 158
duke@0 159 // set the pending exception
duke@0 160 thread->set_pending_exception(h_exception(), file, line);
duke@0 161
duke@0 162 // vm log
never@3157 163 Events::log_exception(thread, "Threw " INTPTR_FORMAT " at %s:%d", (address)h_exception(), file, line);
duke@0 164 }
duke@0 165
duke@0 166
twisti@3937 167 void Exceptions::_throw_msg(Thread* thread, const char* file, int line, Symbol* name, const char* message,
twisti@3937 168 Handle h_loader, Handle h_protection_domain) {
duke@0 169 // Check for special boot-strapping/vm-thread handling
twisti@3937 170 if (special_exception(thread, file, line, name, message)) return;
duke@0 171 // Create and throw exception
duke@0 172 Handle h_cause(thread, NULL);
twisti@3937 173 Handle h_exception = new_exception(thread, name, message, h_cause, h_loader, h_protection_domain);
never@1011 174 _throw(thread, file, line, h_exception, message);
duke@0 175 }
duke@0 176
twisti@3937 177 void Exceptions::_throw_msg_cause(Thread* thread, const char* file, int line, Symbol* name, const char* message, Handle h_cause,
twisti@3937 178 Handle h_loader, Handle h_protection_domain) {
duke@0 179 // Check for special boot-strapping/vm-thread handling
twisti@3937 180 if (special_exception(thread, file, line, name, message)) return;
duke@0 181 // Create and throw exception and init cause
twisti@3937 182 Handle h_exception = new_exception(thread, name, message, h_cause, h_loader, h_protection_domain);
never@1011 183 _throw(thread, file, line, h_exception, message);
duke@0 184 }
duke@0 185
twisti@3937 186 void Exceptions::_throw_cause(Thread* thread, const char* file, int line, Symbol* name, Handle h_cause,
twisti@3937 187 Handle h_loader, Handle h_protection_domain) {
twisti@3937 188 // Check for special boot-strapping/vm-thread handling
twisti@3937 189 if (special_exception(thread, file, line, h_cause)) return;
twisti@3937 190 // Create and throw exception
twisti@3937 191 Handle h_exception = new_exception(thread, name, h_cause, h_loader, h_protection_domain);
twisti@3937 192 _throw(thread, file, line, h_exception, NULL);
duke@0 193 }
duke@0 194
twisti@3937 195 void Exceptions::_throw_args(Thread* thread, const char* file, int line, Symbol* name, Symbol* signature, JavaCallArguments *args) {
duke@0 196 // Check for special boot-strapping/vm-thread handling
twisti@3937 197 if (special_exception(thread, file, line, name, NULL)) return;
duke@0 198 // Create and throw exception
duke@0 199 Handle h_loader(thread, NULL);
duke@0 200 Handle h_prot(thread, NULL);
twisti@3937 201 Handle exception = new_exception(thread, name, signature, args, h_loader, h_prot);
duke@0 202 _throw(thread, file, line, exception);
duke@0 203 }
duke@0 204
duke@0 205
twisti@3937 206 // Methods for default parameters.
twisti@3937 207 // NOTE: These must be here (and not in the header file) because of include circularities.
twisti@3937 208 void Exceptions::_throw_msg_cause(Thread* thread, const char* file, int line, Symbol* name, const char* message, Handle h_cause) {
twisti@3937 209 _throw_msg_cause(thread, file, line, name, message, h_cause, Handle(thread, NULL), Handle(thread, NULL));
twisti@3937 210 }
twisti@3937 211 void Exceptions::_throw_msg(Thread* thread, const char* file, int line, Symbol* name, const char* message) {
twisti@3937 212 _throw_msg(thread, file, line, name, message, Handle(thread, NULL), Handle(thread, NULL));
twisti@3937 213 }
twisti@3937 214 void Exceptions::_throw_cause(Thread* thread, const char* file, int line, Symbol* name, Handle h_cause) {
twisti@3937 215 _throw_cause(thread, file, line, name, h_cause, Handle(thread, NULL), Handle(thread, NULL));
twisti@3937 216 }
twisti@3937 217
twisti@3937 218
coleenp@2369 219 void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line, methodHandle method) {
duke@0 220 Handle exception;
duke@0 221 if (!THREAD->has_pending_exception()) {
duke@0 222 klassOop k = SystemDictionary::StackOverflowError_klass();
duke@0 223 oop e = instanceKlass::cast(k)->allocate_instance(CHECK);
duke@0 224 exception = Handle(THREAD, e); // fill_in_stack trace does gc
coleenp@1787 225 assert(instanceKlass::cast(k)->is_initialized(), "need to increase min_stack_allowed calculation");
duke@0 226 if (StackTraceInThrowable) {
coleenp@2369 227 java_lang_Throwable::fill_in_stack_trace(exception, method());
duke@0 228 }
duke@0 229 } else {
duke@0 230 // if prior exception, throw that one instead
duke@0 231 exception = Handle(THREAD, THREAD->pending_exception());
duke@0 232 }
coleenp@2369 233 _throw(THREAD, file, line, exception);
duke@0 234 }
duke@0 235
coleenp@2062 236 void Exceptions::fthrow(Thread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) {
duke@0 237 const int max_msg_size = 1024;
duke@0 238 va_list ap;
duke@0 239 va_start(ap, format);
duke@0 240 char msg[max_msg_size];
duke@0 241 vsnprintf(msg, max_msg_size, format, ap);
duke@0 242 msg[max_msg_size-1] = '\0';
duke@0 243 va_end(ap);
duke@0 244 _throw_msg(thread, file, line, h_name, msg);
duke@0 245 }
duke@0 246
duke@0 247 // Creates an exception oop, calls the <init> method with the given signature.
duke@0 248 // and returns a Handle
twisti@3937 249 Handle Exceptions::new_exception(Thread *thread, Symbol* name,
twisti@3937 250 Symbol* signature, JavaCallArguments *args,
twisti@3937 251 Handle h_loader, Handle h_protection_domain) {
duke@0 252 assert(Universe::is_fully_initialized(),
duke@0 253 "cannot be called during initialization");
duke@0 254 assert(thread->is_Java_thread(), "can only be called by a Java thread");
duke@0 255 assert(!thread->has_pending_exception(), "already has exception");
duke@0 256
duke@0 257 Handle h_exception;
duke@0 258
duke@0 259 // Resolve exception klass
twisti@3937 260 klassOop ik = SystemDictionary::resolve_or_fail(name, h_loader, h_protection_domain, true, thread);
twisti@3937 261 instanceKlassHandle klass(thread, ik);
duke@0 262
duke@0 263 if (!thread->has_pending_exception()) {
duke@0 264 assert(klass.not_null(), "klass must exist");
duke@0 265 // We are about to create an instance - so make sure that klass is initialized
duke@0 266 klass->initialize(thread);
duke@0 267 if (!thread->has_pending_exception()) {
duke@0 268 // Allocate new exception
duke@0 269 h_exception = klass->allocate_instance_handle(thread);
duke@0 270 if (!thread->has_pending_exception()) {
duke@0 271 JavaValue result(T_VOID);
duke@0 272 args->set_receiver(h_exception);
duke@0 273 // Call constructor
duke@0 274 JavaCalls::call_special(&result, klass,
coleenp@2062 275 vmSymbols::object_initializer_name(),
duke@0 276 signature,
duke@0 277 args,
duke@0 278 thread);
duke@0 279 }
duke@0 280 }
duke@0 281 }
duke@0 282
duke@0 283 // Check if another exception was thrown in the process, if so rethrow that one
duke@0 284 if (thread->has_pending_exception()) {
duke@0 285 h_exception = Handle(thread, thread->pending_exception());
duke@0 286 thread->clear_pending_exception();
duke@0 287 }
duke@0 288 return h_exception;
duke@0 289 }
duke@0 290
twisti@3937 291 // Creates an exception oop, calls the <init> method with the given signature.
twisti@3937 292 // and returns a Handle
twisti@3937 293 // Initializes the cause if cause non-null
twisti@3937 294 Handle Exceptions::new_exception(Thread *thread, Symbol* name,
twisti@3937 295 Symbol* signature, JavaCallArguments *args,
twisti@3937 296 Handle h_cause,
twisti@3937 297 Handle h_loader, Handle h_protection_domain) {
twisti@3937 298 Handle h_exception = new_exception(thread, name, signature, args, h_loader, h_protection_domain);
twisti@3937 299
twisti@3937 300 // Future: object initializer should take a cause argument
twisti@3937 301 if (h_cause.not_null()) {
twisti@3937 302 assert(h_cause->is_a(SystemDictionary::Throwable_klass()),
twisti@3937 303 "exception cause is not a subclass of java/lang/Throwable");
twisti@3937 304 JavaValue result1(T_OBJECT);
twisti@3937 305 JavaCallArguments args1;
twisti@3937 306 args1.set_receiver(h_exception);
twisti@3937 307 args1.push_oop(h_cause);
twisti@3937 308 JavaCalls::call_virtual(&result1, h_exception->klass(),
twisti@3937 309 vmSymbols::initCause_name(),
twisti@3937 310 vmSymbols::throwable_throwable_signature(),
twisti@3937 311 &args1,
twisti@3937 312 thread);
twisti@3937 313 }
twisti@3937 314
twisti@3937 315 // Check if another exception was thrown in the process, if so rethrow that one
twisti@3937 316 if (thread->has_pending_exception()) {
twisti@3937 317 h_exception = Handle(thread, thread->pending_exception());
twisti@3937 318 thread->clear_pending_exception();
twisti@3937 319 }
twisti@3937 320 return h_exception;
twisti@3937 321 }
twisti@3937 322
twisti@3937 323 // Convenience method. Calls either the <init>() or <init>(Throwable) method when
twisti@3937 324 // creating a new exception
twisti@3937 325 Handle Exceptions::new_exception(Thread* thread, Symbol* name,
twisti@3937 326 Handle h_cause,
twisti@3937 327 Handle h_loader, Handle h_protection_domain,
twisti@3937 328 ExceptionMsgToUtf8Mode to_utf8_safe) {
twisti@3937 329 JavaCallArguments args;
twisti@3937 330 Symbol* signature = NULL;
twisti@3937 331 if (h_cause.is_null()) {
twisti@3937 332 signature = vmSymbols::void_method_signature();
twisti@3937 333 } else {
twisti@3937 334 signature = vmSymbols::throwable_void_signature();
twisti@3937 335 args.push_oop(h_cause);
twisti@3937 336 }
twisti@3937 337 return new_exception(thread, name, signature, &args, h_loader, h_protection_domain);
twisti@3937 338 }
twisti@3937 339
duke@0 340 // Convenience method. Calls either the <init>() or <init>(String) method when
duke@0 341 // creating a new exception
twisti@3937 342 Handle Exceptions::new_exception(Thread* thread, Symbol* name,
duke@0 343 const char* message, Handle h_cause,
twisti@3937 344 Handle h_loader, Handle h_protection_domain,
duke@0 345 ExceptionMsgToUtf8Mode to_utf8_safe) {
duke@0 346 JavaCallArguments args;
coleenp@2062 347 Symbol* signature = NULL;
duke@0 348 if (message == NULL) {
coleenp@2062 349 signature = vmSymbols::void_method_signature();
duke@0 350 } else {
duke@0 351 // We want to allocate storage, but we can't do that if there's
duke@0 352 // a pending exception, so we preserve any pending exception
duke@0 353 // around the allocation.
duke@0 354 // If we get an exception from the allocation, prefer that to
duke@0 355 // the exception we are trying to build, or the pending exception.
duke@0 356 // This is sort of like what PRESERVE_EXCEPTION_MARK does, except
duke@0 357 // for the preferencing and the early returns.
twisti@3937 358 Handle incoming_exception(thread, NULL);
duke@0 359 if (thread->has_pending_exception()) {
duke@0 360 incoming_exception = Handle(thread, thread->pending_exception());
duke@0 361 thread->clear_pending_exception();
duke@0 362 }
duke@0 363 Handle msg;
duke@0 364 if (to_utf8_safe == safe_to_utf8) {
duke@0 365 // Make a java UTF8 string.
duke@0 366 msg = java_lang_String::create_from_str(message, thread);
duke@0 367 } else {
duke@0 368 // Make a java string keeping the encoding scheme of the original string.
duke@0 369 msg = java_lang_String::create_from_platform_dependent_str(message, thread);
duke@0 370 }
duke@0 371 if (thread->has_pending_exception()) {
duke@0 372 Handle exception(thread, thread->pending_exception());
duke@0 373 thread->clear_pending_exception();
duke@0 374 return exception;
duke@0 375 }
duke@0 376 if (incoming_exception.not_null()) {
duke@0 377 return incoming_exception;
duke@0 378 }
duke@0 379 args.push_oop(msg);
coleenp@2062 380 signature = vmSymbols::string_void_signature();
duke@0 381 }
twisti@3937 382 return new_exception(thread, name, signature, &args, h_cause, h_loader, h_protection_domain);
duke@0 383 }
duke@0 384
duke@0 385 // Another convenience method that creates handles for null class loaders and
duke@0 386 // protection domains and null causes.
duke@0 387 // If the last parameter 'to_utf8_mode' is safe_to_utf8,
duke@0 388 // it means we can safely ignore the encoding scheme of the message string and
duke@0 389 // convert it directly to a java UTF8 string. Otherwise, we need to take the
duke@0 390 // encoding scheme of the string into account. One thing we should do at some
duke@0 391 // point is to push this flag down to class java_lang_String since other
duke@0 392 // classes may need similar functionalities.
twisti@3937 393 Handle Exceptions::new_exception(Thread* thread, Symbol* name,
duke@0 394 const char* message,
duke@0 395 ExceptionMsgToUtf8Mode to_utf8_safe) {
duke@0 396
duke@0 397 Handle h_loader(thread, NULL);
duke@0 398 Handle h_prot(thread, NULL);
duke@0 399 Handle h_cause(thread, NULL);
coleenp@2062 400 return Exceptions::new_exception(thread, name, message, h_cause, h_loader,
duke@0 401 h_prot, to_utf8_safe);
duke@0 402 }
duke@0 403
duke@0 404 // Implementation of ExceptionMark
duke@0 405
duke@0 406 ExceptionMark::ExceptionMark(Thread*& thread) {
duke@0 407 thread = Thread::current();
duke@0 408 _thread = thread;
duke@0 409 if (_thread->has_pending_exception()) {
duke@0 410 oop exception = _thread->pending_exception();
duke@0 411 _thread->clear_pending_exception(); // Needed to avoid infinite recursion
duke@0 412 exception->print();
duke@0 413 fatal("ExceptionMark constructor expects no pending exceptions");
duke@0 414 }
duke@0 415 }
duke@0 416
duke@0 417
duke@0 418 ExceptionMark::~ExceptionMark() {
duke@0 419 if (_thread->has_pending_exception()) {
duke@0 420 Handle exception(_thread, _thread->pending_exception());
duke@0 421 _thread->clear_pending_exception(); // Needed to avoid infinite recursion
duke@0 422 if (is_init_completed()) {
duke@0 423 exception->print();
duke@0 424 fatal("ExceptionMark destructor expects no pending exceptions");
duke@0 425 } else {
duke@0 426 vm_exit_during_initialization(exception);
duke@0 427 }
duke@0 428 }
duke@0 429 }
duke@0 430
duke@0 431 // ----------------------------------------------------------------------------------------
duke@0 432
duke@0 433 #ifndef PRODUCT
duke@0 434 // caller frees value_string if necessary
kvn@1604 435 void Exceptions::debug_check_abort(const char *value_string, const char* message) {
duke@0 436 if (AbortVMOnException != NULL && value_string != NULL &&
duke@0 437 strstr(value_string, AbortVMOnException)) {
kvn@1604 438 if (AbortVMOnExceptionMessage == NULL || message == NULL ||
kvn@1604 439 strcmp(message, AbortVMOnExceptionMessage) == 0) {
kvn@1604 440 fatal(err_msg("Saw %s, aborting", value_string));
kvn@1604 441 }
duke@0 442 }
duke@0 443 }
duke@0 444
kvn@1604 445 void Exceptions::debug_check_abort(Handle exception, const char* message) {
duke@0 446 if (AbortVMOnException != NULL) {
duke@0 447 ResourceMark rm;
kvn@1604 448 if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) {
kvn@1604 449 oop msg = java_lang_Throwable::message(exception);
kvn@1604 450 if (msg != NULL) {
kvn@1604 451 message = java_lang_String::as_utf8_string(msg);
kvn@1604 452 }
kvn@1604 453 }
kvn@1604 454 debug_check_abort(instanceKlass::cast(exception()->klass())->external_name(), message);
duke@0 455 }
duke@0 456 }
duke@0 457 #endif