src/hotspot/share/prims/jvmtiExport.cpp
changeset 48150 bc1cffa26561
parent 48105 8d15b1369c7a
child 48877 e4d80042ff19
--- a/src/hotspot/share/prims/jvmtiExport.cpp	Tue Nov 28 17:11:02 2017 -0500
+++ b/src/hotspot/share/prims/jvmtiExport.cpp	Wed Nov 29 09:26:58 2017 +0900
@@ -2578,7 +2578,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;
@@ -2628,6 +2628,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
@@ -2654,9 +2656,14 @@
       }
 
       // Agent_OnAttach executed so completion status is JNI_OK
-      st->print_cr("%d", result);
+      st->print_cr("return code: %d", result);
       result = JNI_OK;
     }
+  } else {
+    st->print_cr("%s was not loaded.", agent);
+    if (*ebuf != '\0') {
+      st->print_cr("%s", ebuf);
+    }
   }
   return result;
 }