Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8153108 | 9-repo-mobile | Gary Adams | P3 | Resolved | Fixed | team |
The workaround in mobile/dev repos adds INCLUDE_SERVICE conditional compilation checks.
hotspot/src/share/vm/prims/jvmtiExport.hpp:
...
#if INCLUDE_SERVICES
// attach support
static jint load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
static jint load_agent_library(AttachOperation* op, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
#endif // INCLUDE_SERVICES
hotspot/src/share/vm/services/diagnosticCommand.cpp: proposed
void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) {
if (_libpath.value() == NULL) {
output()->print_cr("JVMTI.agent_load dcmd needs library path.");
return;
}
char *suffix = strrchr(_libpath.value(), '.');
bool is_java_agent = (suffix != NULL) && (strncmp(".jar", suffix, 4) == 0);
#if INCLUDE_SERVICES
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.");
return;
}
char *opt = (char *)os::malloc(opt_len, mtInternal);
if (opt == NULL) {
output()->print_cr("JVMTI agent attach failed: "
"Could not allocate %zu bytes for argument.",
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());
}
#endif
}
- backported by
-
JDK-8153108 jvmti diagnostics commands requires INCLUDE_SERVICES
-
- Resolved
-
- relates to
-
JDK-8147388 Add diagnostic commands to attach JVMTI agent.
-
- Resolved
-