diff -r d060826d0911 src/share/vm/prims/jvmtiExport.cpp --- a/src/share/vm/prims/jvmtiExport.cpp Fri Sep 09 06:44:31 2016 +0000 +++ b/src/share/vm/prims/jvmtiExport.cpp Fri Sep 09 22:12:45 2016 +0900 @@ -2331,7 +2331,7 @@ jint JvmtiExport::load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* st) { - char ebuf[1024]; + char ebuf[1024] = {0}; char buffer[JVM_MAXPATHLEN]; void* library = NULL; jint result = JNI_ERR; @@ -2382,6 +2382,8 @@ if (!agent_lib->is_static_lib()) { os::dll_unload(library); } + st->print_cr("%s is not available in %s", + on_attach_symbols[0], agent_lib->name()); delete agent_lib; } else { // Invoke the Agent_OnAttach function @@ -2396,6 +2398,8 @@ // Agent_OnAttach may have used JNI if (HAS_PENDING_EXCEPTION) { + java_lang_Throwable::print(PENDING_EXCEPTION, st); + st->cr(); CLEAR_PENDING_EXCEPTION; } @@ -2407,9 +2411,15 @@ delete agent_lib; } - st->print_cr("%d", result); + st->print_cr("return code: %d", result); + } + } else { + st->print_cr("%s was not loaded.", agent); + if (*ebuf != '\0') { + st->print_cr("%s", ebuf); } } + return result; }