comparison src/share/vm/jvmci/jvmciRuntime.cpp @ 23329:bc5552dc384b

Use VM routines to print stack traces from C++ code.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 21 Mar 2016 13:52:18 +0100
parents 19c85f6618ed
children e0a15983ab51
comparison
equal deleted inserted replaced
23328:d6cbb275d6ce 23329:bc5552dc384b
911 } 911 }
912 } 912 }
913 return false; 913 return false;
914 } 914 }
915 915
916 void JVMCIRuntime::call_printStackTrace(Handle exception, Thread* thread) {
917 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
918 JavaValue result(T_VOID);
919 JavaCalls::call_virtual(&result,
920 exception,
921 KlassHandle(thread,
922 SystemDictionary::Throwable_klass()),
923 vmSymbols::printStackTrace_name(),
924 vmSymbols::void_method_signature(),
925 thread);
926 }
927
928 void JVMCIRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { 916 void JVMCIRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
929 Thread* THREAD = Thread::current(); 917 Thread* THREAD = Thread::current();
930 CLEAR_PENDING_EXCEPTION; 918 CLEAR_PENDING_EXCEPTION;
931 tty->print_raw_cr(message); 919 tty->print_raw_cr(message);
932 call_printStackTrace(exception, THREAD); 920
921 java_lang_Throwable::print(exception, tty);
922 tty->cr();
923 java_lang_Throwable::print_stack_trace(exception(), tty);
933 924
934 // Give other aborting threads to also print their stack traces. 925 // Give other aborting threads to also print their stack traces.
935 // This can be very useful when debugging class initialization 926 // This can be very useful when debugging class initialization
936 // failures. 927 // failures.
937 os::sleep(THREAD, 200, false); 928 os::sleep(THREAD, 200, false);