< prev index next >

src/share/vm/services/diagnosticCommand.cpp

Print this page

        

*** 275,288 **** return; } char *suffix = strrchr(_libpath.value(), '.'); bool is_java_agent = (suffix != NULL) && (strncmp(".jar", suffix, 4) == 0); if (is_java_agent) { if (_option.value() == NULL) { ! JvmtiExport::load_agent_library("instrument", "false", _libpath.value(), output()); } else { size_t opt_len = strlen(_libpath.value()) + strlen(_option.value()) + 2; if (opt_len > 4096) { output()->print_cr("JVMTI agent attach failed: Options is too long."); --- 275,289 ---- return; } char *suffix = strrchr(_libpath.value(), '.'); bool is_java_agent = (suffix != NULL) && (strncmp(".jar", suffix, 4) == 0); + jint result = JNI_ERR; if (is_java_agent) { if (_option.value() == NULL) { ! result = JvmtiExport::load_agent_library("instrument", "false", _libpath.value(), output()); } else { size_t opt_len = strlen(_libpath.value()) + strlen(_option.value()) + 2; if (opt_len > 4096) { output()->print_cr("JVMTI agent attach failed: Options is too long.");
*** 296,313 **** opt_len); return; } jio_snprintf(opt, opt_len, "%s=%s", _libpath.value(), _option.value()); ! JvmtiExport::load_agent_library("instrument", "false", opt, output()); os::free(opt); } } else { ! JvmtiExport::load_agent_library(_libpath.value(), "true", _option.value(), output()); } } int JVMTIAgentLoadDCmd::num_arguments() { ResourceMark rm; JVMTIAgentLoadDCmd* dcmd = new JVMTIAgentLoadDCmd(NULL, false); --- 297,318 ---- opt_len); return; } jio_snprintf(opt, opt_len, "%s=%s", _libpath.value(), _option.value()); ! result = JvmtiExport::load_agent_library("instrument", "false", ! opt, output()); os::free(opt); } } else { ! result = JvmtiExport::load_agent_library(_libpath.value(), "true", _option.value(), output()); } + + output()->print_cr("JVMTI agent attach %s.", + (result == JNI_OK) ? "succeeded" : "failed"); } int JVMTIAgentLoadDCmd::num_arguments() { ResourceMark rm; JVMTIAgentLoadDCmd* dcmd = new JVMTIAgentLoadDCmd(NULL, false);
< prev index next >