--- old/src/share/vm/services/diagnosticCommand.cpp 2015-02-09 16:32:24.000000000 -0800 +++ new/src/share/vm/services/diagnosticCommand.cpp 2015-02-09 16:32:24.000000000 -0800 @@ -57,6 +57,7 @@ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); #endif // INCLUDE_SERVICES @@ -66,9 +67,6 @@ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); -#if INCLUDE_SERVICES - DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); -#endif // Enhanced JMX Agent Support // These commands won't be exported via the DiagnosticCommandMBean until an @@ -699,8 +697,34 @@ } #if INCLUDE_SERVICES +ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) : + DCmdWithParser(output, heap), + _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"), + _print_subclasses("-s", "If a classname is specified, print its subclasses. " + "Otherwise only its superclasses are printed.", "BOOLEAN", false, "false"), + _classname("classname", "Name of class whose hierarchy should be printed. " + "If not specified, all class hierarchies are printed.", + "STRING", false) { + _dcmdparser.add_dcmd_option(&_print_interfaces); + _dcmdparser.add_dcmd_option(&_print_subclasses); + _dcmdparser.add_dcmd_argument(&_classname); +} + void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) { - VM_PrintClassHierachry printClassHierarchyOp(output()); + VM_PrintClassHierachry printClassHierarchyOp(output(), _print_interfaces.value(), + _print_subclasses.value(), _classname.value()); VMThread::execute(&printClassHierarchyOp); } + +int ClassHierarchyDCmd::num_arguments() { + ResourceMark rm; + ClassHierarchyDCmd* dcmd = new ClassHierarchyDCmd(NULL, false); + if (dcmd != NULL) { + DCmdMark mark(dcmd); + return dcmd->_dcmdparser.num_arguments(); + } else { + return 0; + } +} + #endif