< prev index next >
src/hotspot/share/prims/jvmtiExport.cpp
Print this page
*** 2473,2483 ****
typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *);
}
jint JvmtiExport::load_agent_library(const char *agent, const char *absParam,
const char *options, outputStream* st) {
! char ebuf[1024];
char buffer[JVM_MAXPATHLEN];
void* library = NULL;
jint result = JNI_ERR;
const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS;
size_t num_symbol_entries = ARRAY_SIZE(on_attach_symbols);
--- 2473,2483 ----
typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *);
}
jint JvmtiExport::load_agent_library(const char *agent, const char *absParam,
const char *options, outputStream* st) {
! char ebuf[1024] = {0};
char buffer[JVM_MAXPATHLEN];
void* library = NULL;
jint result = JNI_ERR;
const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS;
size_t num_symbol_entries = ARRAY_SIZE(on_attach_symbols);
*** 2523,2532 ****
--- 2523,2534 ----
if (on_attach_entry == NULL) {
// Agent_OnAttach missing - unload library
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
JavaThread* THREAD = JavaThread::current();
{
*** 2537,2546 ****
--- 2539,2550 ----
result = (*on_attach_entry)(&main_vm, (char*)options, NULL);
}
// Agent_OnAttach may have used JNI
if (HAS_PENDING_EXCEPTION) {
+ java_lang_Throwable::print(PENDING_EXCEPTION, st);
+ st->cr();
CLEAR_PENDING_EXCEPTION;
}
// If OnAttach returns JNI_OK then we add it to the list of
// agent libraries so that we can call Agent_OnUnload later.
*** 2548,2562 ****
Arguments::add_loaded_agent(agent_lib);
} else {
delete agent_lib;
}
! // Agent_OnAttach executed so completion status is JNI_OK
! st->print_cr("%d", result);
result = JNI_OK;
}
}
return result;
}
#endif // INCLUDE_SERVICES
////////////////////////////////////////////////////////////////////////////////////////////////
--- 2552,2571 ----
Arguments::add_loaded_agent(agent_lib);
} else {
delete agent_lib;
}
! 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;
}
#endif // INCLUDE_SERVICES
////////////////////////////////////////////////////////////////////////////////////////////////
< prev index next >