8151991: jvmti diagnostics commands requires INCLUDE_SERVICES
Summary: guard jvmti diagnostic commands by appropriate defines
Reviewed-by: sspitsyn, dholmes, gadams
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp Thu Mar 24 23:07:06 2016 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp Fri Mar 25 12:54:16 2016 +0300
@@ -2315,6 +2315,8 @@
}
////////////////////////////////////////////////////////////////////////////////////////////////
+#if INCLUDE_SERVICES
+// Attach is disabled if SERVICES is not included
// type for the Agent_OnAttach entry point
extern "C" {
@@ -2416,6 +2418,7 @@
return result;
}
+#endif // INCLUDE_SERVICES
////////////////////////////////////////////////////////////////////////////////////////////////
// Setup current current thread for event collection.
--- a/hotspot/src/share/vm/prims/jvmtiExport.hpp Thu Mar 24 23:07:06 2016 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiExport.hpp Fri Mar 25 12:54:16 2016 +0300
@@ -377,9 +377,11 @@
static void transition_pending_onload_raw_monitors() NOT_JVMTI_RETURN;
+#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
// SetNativeMethodPrefix support
static char** get_all_native_method_prefixes(int* count_ptr) NOT_JVMTI_RETURN_(NULL);
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Thu Mar 24 23:07:06 2016 -0700
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Fri Mar 25 12:54:16 2016 +0300
@@ -61,17 +61,19 @@
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false));
-#if INCLUDE_SERVICES // Heap dumping/inspection supported
+#if INCLUDE_SERVICES
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
+#if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd
+ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
+#endif // INCLUDE_JVMTI
#endif // INCLUDE_SERVICES
#if INCLUDE_JVMTI
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
- DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
#endif // INCLUDE_JVMTI
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
@@ -255,6 +257,7 @@
}
}
+#if INCLUDE_SERVICES
JVMTIAgentLoadDCmd::JVMTIAgentLoadDCmd(outputStream* output, bool heap) :
DCmdWithParser(output, heap),
_libpath("library path", "Absolute path of the JVMTI agent to load.",
@@ -314,6 +317,7 @@
return 0;
}
}
+#endif // INCLUDE_SERVICES
void PrintSystemPropertiesDCmd::execute(DCmdSource source, TRAPS) {
// load sun.misc.VMSupport
--- a/hotspot/src/share/vm/services/diagnosticCommand.hpp Thu Mar 24 23:07:06 2016 -0700
+++ b/hotspot/src/share/vm/services/diagnosticCommand.hpp Fri Mar 25 12:54:16 2016 +0300
@@ -174,6 +174,8 @@
virtual void execute(DCmdSource source, TRAPS);
};
+#if INCLUDE_SERVICES
+#if INCLUDE_JVMTI
class JVMTIAgentLoadDCmd : public DCmdWithParser {
protected:
DCmdArgument<char*> _libpath;
@@ -193,6 +195,8 @@
static int num_arguments();
virtual void execute(DCmdSource source, TRAPS);
};
+#endif // INCLUDE_JVMTI
+#endif // INCLUDE_SERVICES
class VMDynamicLibrariesDCmd : public DCmd {
public: