changeset 10709:b85ea7097b6e

8151991: jvmti diagnostics commands requires INCLUDE_SERVICES Summary: guard jvmti diagnostic commands by appropriate defines Reviewed-by: sspitsyn, dholmes, gadams
author dsamersoff
date Fri, 25 Mar 2016 12:54:16 +0300
parents ab681d5299dc
children 9489df4f2b94
files src/share/vm/prims/jvmtiExport.cpp src/share/vm/prims/jvmtiExport.hpp src/share/vm/services/diagnosticCommand.cpp src/share/vm/services/diagnosticCommand.hpp
diffstat 4 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/prims/jvmtiExport.cpp	Thu Mar 24 23:07:06 2016 -0700
+++ b/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/src/share/vm/prims/jvmtiExport.hpp	Thu Mar 24 23:07:06 2016 -0700
+++ b/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/src/share/vm/services/diagnosticCommand.cpp	Thu Mar 24 23:07:06 2016 -0700
+++ b/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/src/share/vm/services/diagnosticCommand.hpp	Thu Mar 24 23:07:06 2016 -0700
+++ b/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: