< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page
@@ -117,10 +117,11 @@
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassesDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export, true, false));
+   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintClassLayoutDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<EventLogDCmd>(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

@@ -157,11 +158,10 @@
    uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false));
- 
    // Debug on cmd (only makes sense with JVMTI since the agentlib needs it).
  #if INCLUDE_JVMTI
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, true));
  #endif // INCLUDE_JVMTI
  

@@ -953,11 +953,35 @@
  void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
    VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
                                                 _print_subclasses.value(), _classname.value());
    VMThread::execute(&printClassHierarchyOp);
  }
- #endif
+ 
+ PrintClassLayoutDCmd::PrintClassLayoutDCmd(outputStream* output, bool heap) :
+                                        DCmdWithParser(output, heap),
+   _classname("classname", "Name of class whose layout should be printed. ",
+              "STRING", true) {
+   _dcmdparser.add_dcmd_argument(&_classname);
+ }
+ 
+ void PrintClassLayoutDCmd::execute(DCmdSource source, TRAPS) {
+   VM_PrintClassLayout printClassLayoutOp(output(), _classname.value());
+   VMThread::execute(&printClassLayoutOp);
+ }
+ 
+ int PrintClassLayoutDCmd::num_arguments() {
+   ResourceMark rm;
+   PrintClassLayoutDCmd* dcmd = new PrintClassLayoutDCmd(nullptr, false);
+   if (dcmd != nullptr) {
+     DCmdMark mark(dcmd);
+     return dcmd->_dcmdparser.num_arguments();
+   } else {
+     return 0;
+   }
+ }
+ 
+ #endif // INCLUDE_SERVICES
  
  ClassesDCmd::ClassesDCmd(outputStream* output, bool heap) :
                                       DCmdWithParser(output, heap),
    _verbose("-verbose",
             "Dump the detailed content of a Java class. "
< prev index next >