1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "classfile/classLoaderStats.hpp"
  28 #include "classfile/compactHashtable.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/directivesParser.hpp"
  31 #include "gc/shared/vmGCOperations.hpp"
  32 #include "memory/resourceArea.hpp"
  33 #include "oops/objArrayOop.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "oops/typeArrayOop.inline.hpp"
  36 #include "runtime/globals.hpp"
  37 #include "runtime/handles.inline.hpp"
  38 #include "runtime/javaCalls.hpp"
  39 #include "runtime/os.hpp"
  40 #include "services/diagnosticArgument.hpp"
  41 #include "services/diagnosticCommand.hpp"
  42 #include "services/diagnosticFramework.hpp"
  43 #include "services/heapDumper.hpp"
  44 #include "services/management.hpp"
  45 #include "services/writeableFlags.hpp"
  46 #include "utilities/debug.hpp"
  47 #include "utilities/formatBuffer.hpp"
  48 #include "utilities/macros.hpp"
  49 
  50 
  51 static void loadAgentModule(TRAPS) {
  52   ResourceMark rm(THREAD);
  53   HandleMark hm(THREAD);
  54 
  55   JavaValue result(T_OBJECT);
  56   Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK);
  57   JavaCalls::call_static(&result,
  58                          SystemDictionary::module_Modules_klass(),
  59                          vmSymbols::loadModule_name(),
  60                          vmSymbols::loadModule_signature(),
  61                          h_module_name,
  62                          THREAD);
  63 }
  64 
  65 void DCmdRegistrant::register_dcmds(){
  66   // Registration of the diagnostic commands
  67   // First argument specifies which interfaces will export the command
  68   // Second argument specifies if the command is enabled
  69   // Third  argument specifies if the command is hidden
  70   uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI
  71                          | DCmd_Source_MBean;
  72   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export, true, false));
  73   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export, true, false));
  74   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
  75   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
  76   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
  77   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export, true, false));
  78   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
  79   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
  80   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export, true, false));
  81   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
  82   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
  83   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false));
  84   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false));
  85 #if INCLUDE_SERVICES
  86   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
  87   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
  88   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
  89   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false));
  90   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
  91   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
  92   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
  93   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MetaspaceDCmd>(full_export, true, false));
  94 #if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd
  95   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
  96 #endif // INCLUDE_JVMTI
  97 #endif // INCLUDE_SERVICES
  98 #if INCLUDE_JVMTI
  99   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
 100 #endif // INCLUDE_JVMTI
 101   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
 102   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 103   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
 104   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
 105   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
 106   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TouchedMethodsDCmd>(full_export, true, false));
 107   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 108 
 109   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 110   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 111   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 112   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 113 
 114   // Enhanced JMX Agent Support
 115   // These commands won't be exported via the DiagnosticCommandMBean until an
 116   // appropriate permission is created for them
 117   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
 118   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
 119   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
 120   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
 121   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false));
 122 
 123 }
 124 
 125 #ifndef HAVE_EXTRA_DCMD
 126 void DCmdRegistrant::register_dcmds_ext(){
 127    // Do nothing here
 128 }
 129 #endif
 130 
 131 
 132 HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
 133   _all("-all", "Show help for all commands", "BOOLEAN", false, "false"),
 134   _cmd("command name", "The name of the command for which we want help",
 135         "STRING", false) {
 136   _dcmdparser.add_dcmd_option(&_all);
 137   _dcmdparser.add_dcmd_argument(&_cmd);
 138 };
 139 
 140 void HelpDCmd::execute(DCmdSource source, TRAPS) {
 141   if (_all.value()) {
 142     GrowableArray<const char*>* cmd_list = DCmdFactory::DCmd_list(source);
 143     for (int i = 0; i < cmd_list->length(); i++) {
 144       DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
 145                                                   strlen(cmd_list->at(i)));
 146       output()->print_cr("%s%s", factory->name(),
 147                          factory->is_enabled() ? "" : " [disabled]");
 148       output()->print_cr("\t%s", factory->description());
 149       output()->cr();
 150       factory = factory->next();
 151     }
 152   } else if (_cmd.has_value()) {
 153     DCmd* cmd = NULL;
 154     DCmdFactory* factory = DCmdFactory::factory(source, _cmd.value(),
 155                                                 strlen(_cmd.value()));
 156     if (factory != NULL) {
 157       output()->print_cr("%s%s", factory->name(),
 158                          factory->is_enabled() ? "" : " [disabled]");
 159       output()->print_cr("%s", factory->description());
 160       output()->print_cr("\nImpact: %s", factory->impact());
 161       JavaPermission p = factory->permission();
 162       if(p._class != NULL) {
 163         if(p._action != NULL) {
 164           output()->print_cr("\nPermission: %s(%s, %s)",
 165                   p._class, p._name == NULL ? "null" : p._name, p._action);
 166         } else {
 167           output()->print_cr("\nPermission: %s(%s)",
 168                   p._class, p._name == NULL ? "null" : p._name);
 169         }
 170       }
 171       output()->cr();
 172       cmd = factory->create_resource_instance(output());
 173       if (cmd != NULL) {
 174         DCmdMark mark(cmd);
 175         cmd->print_help(factory->name());
 176       }
 177     } else {
 178       output()->print_cr("Help unavailable : '%s' : No such command", _cmd.value());
 179     }
 180   } else {
 181     output()->print_cr("The following commands are available:");
 182     GrowableArray<const char *>* cmd_list = DCmdFactory::DCmd_list(source);
 183     for (int i = 0; i < cmd_list->length(); i++) {
 184       DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
 185                                                   strlen(cmd_list->at(i)));
 186       output()->print_cr("%s%s", factory->name(),
 187                          factory->is_enabled() ? "" : " [disabled]");
 188       factory = factory->_next;
 189     }
 190     output()->print_cr("\nFor more information about a specific command use 'help <command>'.");
 191   }
 192 }
 193 
 194 int HelpDCmd::num_arguments() {
 195   ResourceMark rm;
 196   HelpDCmd* dcmd = new HelpDCmd(NULL, false);
 197   if (dcmd != NULL) {
 198     DCmdMark mark(dcmd);
 199     return dcmd->_dcmdparser.num_arguments();
 200   } else {
 201     return 0;
 202   }
 203 }
 204 
 205 void VersionDCmd::execute(DCmdSource source, TRAPS) {
 206   output()->print_cr("%s version %s", Abstract_VM_Version::vm_name(),
 207           Abstract_VM_Version::vm_release());
 208   JDK_Version jdk_version = JDK_Version::current();
 209   if (jdk_version.patch_version() > 0) {
 210     output()->print_cr("JDK %d.%d.%d.%d", jdk_version.major_version(),
 211             jdk_version.minor_version(), jdk_version.security_version(),
 212             jdk_version.patch_version());
 213   } else {
 214     output()->print_cr("JDK %d.%d.%d", jdk_version.major_version(),
 215             jdk_version.minor_version(), jdk_version.security_version());
 216   }
 217 }
 218 
 219 PrintVMFlagsDCmd::PrintVMFlagsDCmd(outputStream* output, bool heap) :
 220                                    DCmdWithParser(output, heap),
 221   _all("-all", "Print all flags supported by the VM", "BOOLEAN", false, "false") {
 222   _dcmdparser.add_dcmd_option(&_all);
 223 }
 224 
 225 void PrintVMFlagsDCmd::execute(DCmdSource source, TRAPS) {
 226   if (_all.value()) {
 227     CommandLineFlags::printFlags(output(), true);
 228   } else {
 229     CommandLineFlags::printSetFlags(output());
 230   }
 231 }
 232 
 233 int PrintVMFlagsDCmd::num_arguments() {
 234     ResourceMark rm;
 235     PrintVMFlagsDCmd* dcmd = new PrintVMFlagsDCmd(NULL, false);
 236     if (dcmd != NULL) {
 237       DCmdMark mark(dcmd);
 238       return dcmd->_dcmdparser.num_arguments();
 239     } else {
 240       return 0;
 241     }
 242 }
 243 
 244 SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) :
 245                                    DCmdWithParser(output, heap),
 246   _flag("flag name", "The name of the flag we want to set",
 247         "STRING", true),
 248   _value("string value", "The value we want to set", "STRING", false) {
 249   _dcmdparser.add_dcmd_argument(&_flag);
 250   _dcmdparser.add_dcmd_argument(&_value);
 251 }
 252 
 253 void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) {
 254   const char* val = NULL;
 255   if (_value.value() != NULL) {
 256     val = _value.value();
 257   }
 258 
 259   FormatBuffer<80> err_msg("%s", "");
 260   int ret = WriteableFlags::set_flag(_flag.value(), val, Flag::MANAGEMENT, err_msg);
 261 
 262   if (ret != Flag::SUCCESS) {
 263     output()->print_cr("%s", err_msg.buffer());
 264   }
 265 }
 266 
 267 int SetVMFlagDCmd::num_arguments() {
 268   ResourceMark rm;
 269   SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false);
 270   if (dcmd != NULL) {
 271     DCmdMark mark(dcmd);
 272     return dcmd->_dcmdparser.num_arguments();
 273   } else {
 274     return 0;
 275   }
 276 }
 277 
 278 void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) {
 279   if (JvmtiExport::should_post_data_dump()) {
 280     JvmtiExport::post_data_dump();
 281   }
 282 }
 283 
 284 #if INCLUDE_SERVICES
 285 JVMTIAgentLoadDCmd::JVMTIAgentLoadDCmd(outputStream* output, bool heap) :
 286                                        DCmdWithParser(output, heap),
 287   _libpath("library path", "Absolute path of the JVMTI agent to load.",
 288            "STRING", true),
 289   _option("agent option", "Option string to pass the agent.", "STRING", false) {
 290   _dcmdparser.add_dcmd_argument(&_libpath);
 291   _dcmdparser.add_dcmd_argument(&_option);
 292 }
 293 
 294 void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) {
 295 
 296   if (_libpath.value() == NULL) {
 297     output()->print_cr("JVMTI.agent_load dcmd needs library path.");
 298     return;
 299   }
 300 
 301   char *suffix = strrchr(_libpath.value(), '.');
 302   bool is_java_agent = (suffix != NULL) && (strncmp(".jar", suffix, 4) == 0);
 303 
 304   if (is_java_agent) {
 305     if (_option.value() == NULL) {
 306       JvmtiExport::load_agent_library("instrument", "false",
 307                                       _libpath.value(), output());
 308     } else {
 309       size_t opt_len = strlen(_libpath.value()) + strlen(_option.value()) + 2;
 310       if (opt_len > 4096) {
 311         output()->print_cr("JVMTI agent attach failed: Options is too long.");
 312         return;
 313       }
 314 
 315       char *opt = (char *)os::malloc(opt_len, mtInternal);
 316       if (opt == NULL) {
 317         output()->print_cr("JVMTI agent attach failed: "
 318                            "Could not allocate " SIZE_FORMAT " bytes for argument.",
 319                            opt_len);
 320         return;
 321       }
 322 
 323       jio_snprintf(opt, opt_len, "%s=%s", _libpath.value(), _option.value());
 324       JvmtiExport::load_agent_library("instrument", "false", opt, output());
 325 
 326       os::free(opt);
 327     }
 328   } else {
 329     JvmtiExport::load_agent_library(_libpath.value(), "true",
 330                                     _option.value(), output());
 331   }
 332 }
 333 
 334 int JVMTIAgentLoadDCmd::num_arguments() {
 335   ResourceMark rm;
 336   JVMTIAgentLoadDCmd* dcmd = new JVMTIAgentLoadDCmd(NULL, false);
 337   if (dcmd != NULL) {
 338     DCmdMark mark(dcmd);
 339     return dcmd->_dcmdparser.num_arguments();
 340   } else {
 341     return 0;
 342   }
 343 }
 344 #endif // INCLUDE_SERVICES
 345 
 346 void PrintSystemPropertiesDCmd::execute(DCmdSource source, TRAPS) {
 347   // load VMSupport
 348   Symbol* klass = vmSymbols::jdk_internal_vm_VMSupport();
 349   Klass* k = SystemDictionary::resolve_or_fail(klass, true, CHECK);
 350   InstanceKlass* ik = InstanceKlass::cast(k);
 351   if (ik->should_be_initialized()) {
 352     ik->initialize(THREAD);
 353   }
 354   if (HAS_PENDING_EXCEPTION) {
 355     java_lang_Throwable::print(PENDING_EXCEPTION, output());
 356     output()->cr();
 357     CLEAR_PENDING_EXCEPTION;
 358     return;
 359   }
 360 
 361   // invoke the serializePropertiesToByteArray method
 362   JavaValue result(T_OBJECT);
 363   JavaCallArguments args;
 364 
 365   Symbol* signature = vmSymbols::serializePropertiesToByteArray_signature();
 366   JavaCalls::call_static(&result,
 367                          ik,
 368                          vmSymbols::serializePropertiesToByteArray_name(),
 369                          signature,
 370                          &args,
 371                          THREAD);
 372   if (HAS_PENDING_EXCEPTION) {
 373     java_lang_Throwable::print(PENDING_EXCEPTION, output());
 374     output()->cr();
 375     CLEAR_PENDING_EXCEPTION;
 376     return;
 377   }
 378 
 379   // The result should be a [B
 380   oop res = (oop)result.get_jobject();
 381   assert(res->is_typeArray(), "just checking");
 382   assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking");
 383 
 384   // copy the bytes to the output stream
 385   typeArrayOop ba = typeArrayOop(res);
 386   jbyte* addr = typeArrayOop(res)->byte_at_addr(0);
 387   output()->print_raw((const char*)addr, ba->length());
 388 }
 389 
 390 VMUptimeDCmd::VMUptimeDCmd(outputStream* output, bool heap) :
 391                            DCmdWithParser(output, heap),
 392   _date("-date", "Add a prefix with current date", "BOOLEAN", false, "false") {
 393   _dcmdparser.add_dcmd_option(&_date);
 394 }
 395 
 396 void VMUptimeDCmd::execute(DCmdSource source, TRAPS) {
 397   if (_date.value()) {
 398     output()->date_stamp(true, "", ": ");
 399   }
 400   output()->time_stamp().update_to(tty->time_stamp().ticks());
 401   output()->stamp();
 402   output()->print_cr(" s");
 403 }
 404 
 405 int VMUptimeDCmd::num_arguments() {
 406   ResourceMark rm;
 407   VMUptimeDCmd* dcmd = new VMUptimeDCmd(NULL, false);
 408   if (dcmd != NULL) {
 409     DCmdMark mark(dcmd);
 410     return dcmd->_dcmdparser.num_arguments();
 411   } else {
 412     return 0;
 413   }
 414 }
 415 
 416 void VMInfoDCmd::execute(DCmdSource source, TRAPS) {
 417   VMError::print_vm_info(_output);
 418 }
 419 
 420 void SystemGCDCmd::execute(DCmdSource source, TRAPS) {
 421   Universe::heap()->collect(GCCause::_dcmd_gc_run);
 422 }
 423 
 424 void RunFinalizationDCmd::execute(DCmdSource source, TRAPS) {
 425   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(),
 426                                                  true, CHECK);
 427   JavaValue result(T_VOID);
 428   JavaCalls::call_static(&result, k,
 429                          vmSymbols::run_finalization_name(),
 430                          vmSymbols::void_method_signature(), CHECK);
 431 }
 432 
 433 void HeapInfoDCmd::execute(DCmdSource source, TRAPS) {
 434   MutexLocker hl(Heap_lock);
 435   Universe::heap()->print_on(output());
 436 }
 437 
 438 void FinalizerInfoDCmd::execute(DCmdSource source, TRAPS) {
 439   ResourceMark rm;
 440 
 441   Klass* k = SystemDictionary::resolve_or_fail(
 442     vmSymbols::finalizer_histogram_klass(), true, CHECK);
 443 
 444   JavaValue result(T_ARRAY);
 445 
 446   // We are calling lang.ref.FinalizerHistogram.getFinalizerHistogram() method
 447   // and expect it to return array of FinalizerHistogramEntry as Object[]
 448 
 449   JavaCalls::call_static(&result, k,
 450                          vmSymbols::get_finalizer_histogram_name(),
 451                          vmSymbols::void_finalizer_histogram_entry_array_signature(), CHECK);
 452 
 453   objArrayOop result_oop = (objArrayOop) result.get_jobject();
 454   if (result_oop->length() == 0) {
 455     output()->print_cr("No instances waiting for finalization found");
 456     return;
 457   }
 458 
 459   oop foop = result_oop->obj_at(0);
 460   InstanceKlass* ik = InstanceKlass::cast(foop->klass());
 461 
 462   fieldDescriptor count_fd, name_fd;
 463 
 464   Klass* count_res = ik->find_field(
 465     vmSymbols::finalizer_histogram_entry_count_field(), vmSymbols::int_signature(), &count_fd);
 466 
 467   Klass* name_res = ik->find_field(
 468     vmSymbols::finalizer_histogram_entry_name_field(), vmSymbols::string_signature(), &name_fd);
 469 
 470   assert(count_res != NULL && name_res != NULL, "Unexpected layout of FinalizerHistogramEntry");
 471 
 472   output()->print_cr("Unreachable instances waiting for finalization");
 473   output()->print_cr("#instances  class name");
 474   output()->print_cr("-----------------------");
 475 
 476   for (int i = 0; i < result_oop->length(); ++i) {
 477     oop element_oop = result_oop->obj_at(i);
 478     oop str_oop = element_oop->obj_field(name_fd.offset());
 479     char *name = java_lang_String::as_utf8_string(str_oop);
 480     int count = element_oop->int_field(count_fd.offset());
 481     output()->print_cr("%10d  %s", count, name);
 482   }
 483 }
 484 
 485 #if INCLUDE_SERVICES // Heap dumping/inspection supported
 486 HeapDumpDCmd::HeapDumpDCmd(outputStream* output, bool heap) :
 487                            DCmdWithParser(output, heap),
 488   _filename("filename","Name of the dump file", "STRING",true),
 489   _all("-all", "Dump all objects, including unreachable objects",
 490        "BOOLEAN", false, "false") {
 491   _dcmdparser.add_dcmd_option(&_all);
 492   _dcmdparser.add_dcmd_argument(&_filename);
 493 }
 494 
 495 void HeapDumpDCmd::execute(DCmdSource source, TRAPS) {
 496   // Request a full GC before heap dump if _all is false
 497   // This helps reduces the amount of unreachable objects in the dump
 498   // and makes it easier to browse.
 499   HeapDumper dumper(!_all.value() /* request GC if _all is false*/);
 500   int res = dumper.dump(_filename.value());
 501   if (res == 0) {
 502     output()->print_cr("Heap dump file created");
 503   } else {
 504     // heap dump failed
 505     ResourceMark rm;
 506     char* error = dumper.error_as_C_string();
 507     if (error == NULL) {
 508       output()->print_cr("Dump failed - reason unknown");
 509     } else {
 510       output()->print_cr("%s", error);
 511     }
 512   }
 513 }
 514 
 515 int HeapDumpDCmd::num_arguments() {
 516   ResourceMark rm;
 517   HeapDumpDCmd* dcmd = new HeapDumpDCmd(NULL, false);
 518   if (dcmd != NULL) {
 519     DCmdMark mark(dcmd);
 520     return dcmd->_dcmdparser.num_arguments();
 521   } else {
 522     return 0;
 523   }
 524 }
 525 
 526 ClassHistogramDCmd::ClassHistogramDCmd(outputStream* output, bool heap) :
 527                                        DCmdWithParser(output, heap),
 528   _all("-all", "Inspect all objects, including unreachable objects",
 529        "BOOLEAN", false, "false") {
 530   _dcmdparser.add_dcmd_option(&_all);
 531 }
 532 
 533 void ClassHistogramDCmd::execute(DCmdSource source, TRAPS) {
 534   VM_GC_HeapInspection heapop(output(),
 535                               !_all.value() /* request full gc if false */);
 536   VMThread::execute(&heapop);
 537 }
 538 
 539 int ClassHistogramDCmd::num_arguments() {
 540   ResourceMark rm;
 541   ClassHistogramDCmd* dcmd = new ClassHistogramDCmd(NULL, false);
 542   if (dcmd != NULL) {
 543     DCmdMark mark(dcmd);
 544     return dcmd->_dcmdparser.num_arguments();
 545   } else {
 546     return 0;
 547   }
 548 }
 549 
 550 #define DEFAULT_COLUMNS "InstBytes,KlassBytes,CpAll,annotations,MethodCount,Bytecodes,MethodAll,ROAll,RWAll,Total"
 551 ClassStatsDCmd::ClassStatsDCmd(outputStream* output, bool heap) :
 552                                        DCmdWithParser(output, heap),
 553   _csv("-csv", "Print in CSV (comma-separated values) format for spreadsheets",
 554        "BOOLEAN", false, "false"),
 555   _all("-all", "Show all columns",
 556        "BOOLEAN", false, "false"),
 557   _help("-help", "Show meaning of all the columns",
 558        "BOOLEAN", false, "false"),
 559   _columns("columns", "Comma-separated list of all the columns to show. "
 560            "If not specified, the following columns are shown: " DEFAULT_COLUMNS,
 561            "STRING", false) {
 562   _dcmdparser.add_dcmd_option(&_all);
 563   _dcmdparser.add_dcmd_option(&_csv);
 564   _dcmdparser.add_dcmd_option(&_help);
 565   _dcmdparser.add_dcmd_argument(&_columns);
 566 }
 567 
 568 void ClassStatsDCmd::execute(DCmdSource source, TRAPS) {
 569   VM_GC_HeapInspection heapop(output(),
 570                               true /* request_full_gc */);
 571   heapop.set_csv_format(_csv.value());
 572   heapop.set_print_help(_help.value());
 573   heapop.set_print_class_stats(true);
 574   if (_all.value()) {
 575     if (_columns.has_value()) {
 576       output()->print_cr("Cannot specify -all and individual columns at the same time");
 577       return;
 578     } else {
 579       heapop.set_columns(NULL);
 580     }
 581   } else {
 582     if (_columns.has_value()) {
 583       heapop.set_columns(_columns.value());
 584     } else {
 585       heapop.set_columns(DEFAULT_COLUMNS);
 586     }
 587   }
 588   VMThread::execute(&heapop);
 589 }
 590 
 591 int ClassStatsDCmd::num_arguments() {
 592   ResourceMark rm;
 593   ClassStatsDCmd* dcmd = new ClassStatsDCmd(NULL, false);
 594   if (dcmd != NULL) {
 595     DCmdMark mark(dcmd);
 596     return dcmd->_dcmdparser.num_arguments();
 597   } else {
 598     return 0;
 599   }
 600 }
 601 #endif // INCLUDE_SERVICES
 602 
 603 ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) :
 604                                DCmdWithParser(output, heap),
 605   _locks("-l", "print java.util.concurrent locks", "BOOLEAN", false, "false") {
 606   _dcmdparser.add_dcmd_option(&_locks);
 607 }
 608 
 609 void ThreadDumpDCmd::execute(DCmdSource source, TRAPS) {
 610   // thread stacks
 611   VM_PrintThreads op1(output(), _locks.value());
 612   VMThread::execute(&op1);
 613 
 614   // JNI global handles
 615   VM_PrintJNI op2(output());
 616   VMThread::execute(&op2);
 617 
 618   // Deadlock detection
 619   VM_FindDeadlocks op3(output());
 620   VMThread::execute(&op3);
 621 }
 622 
 623 int ThreadDumpDCmd::num_arguments() {
 624   ResourceMark rm;
 625   ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false);
 626   if (dcmd != NULL) {
 627     DCmdMark mark(dcmd);
 628     return dcmd->_dcmdparser.num_arguments();
 629   } else {
 630     return 0;
 631   }
 632 }
 633 
 634 // Enhanced JMX Agent support
 635 
 636 JMXStartRemoteDCmd::JMXStartRemoteDCmd(outputStream *output, bool heap_allocated) :
 637 
 638   DCmdWithParser(output, heap_allocated),
 639 
 640   _config_file
 641   ("config.file",
 642    "set com.sun.management.config.file", "STRING", false),
 643 
 644   _jmxremote_host
 645   ("jmxremote.host",
 646    "set com.sun.management.jmxremote.host", "STRING", false),
 647 
 648   _jmxremote_port
 649   ("jmxremote.port",
 650    "set com.sun.management.jmxremote.port", "STRING", false),
 651 
 652   _jmxremote_rmi_port
 653   ("jmxremote.rmi.port",
 654    "set com.sun.management.jmxremote.rmi.port", "STRING", false),
 655 
 656   _jmxremote_ssl
 657   ("jmxremote.ssl",
 658    "set com.sun.management.jmxremote.ssl", "STRING", false),
 659 
 660   _jmxremote_registry_ssl
 661   ("jmxremote.registry.ssl",
 662    "set com.sun.management.jmxremote.registry.ssl", "STRING", false),
 663 
 664   _jmxremote_authenticate
 665   ("jmxremote.authenticate",
 666    "set com.sun.management.jmxremote.authenticate", "STRING", false),
 667 
 668   _jmxremote_password_file
 669   ("jmxremote.password.file",
 670    "set com.sun.management.jmxremote.password.file", "STRING", false),
 671 
 672   _jmxremote_access_file
 673   ("jmxremote.access.file",
 674    "set com.sun.management.jmxremote.access.file", "STRING", false),
 675 
 676   _jmxremote_login_config
 677   ("jmxremote.login.config",
 678    "set com.sun.management.jmxremote.login.config", "STRING", false),
 679 
 680   _jmxremote_ssl_enabled_cipher_suites
 681   ("jmxremote.ssl.enabled.cipher.suites",
 682    "set com.sun.management.jmxremote.ssl.enabled.cipher.suite", "STRING", false),
 683 
 684   _jmxremote_ssl_enabled_protocols
 685   ("jmxremote.ssl.enabled.protocols",
 686    "set com.sun.management.jmxremote.ssl.enabled.protocols", "STRING", false),
 687 
 688   _jmxremote_ssl_need_client_auth
 689   ("jmxremote.ssl.need.client.auth",
 690    "set com.sun.management.jmxremote.need.client.auth", "STRING", false),
 691 
 692   _jmxremote_ssl_config_file
 693   ("jmxremote.ssl.config.file",
 694    "set com.sun.management.jmxremote.ssl_config_file", "STRING", false),
 695 
 696 // JDP Protocol support
 697   _jmxremote_autodiscovery
 698   ("jmxremote.autodiscovery",
 699    "set com.sun.management.jmxremote.autodiscovery", "STRING", false),
 700 
 701    _jdp_port
 702   ("jdp.port",
 703    "set com.sun.management.jdp.port", "INT", false),
 704 
 705    _jdp_address
 706   ("jdp.address",
 707    "set com.sun.management.jdp.address", "STRING", false),
 708 
 709    _jdp_source_addr
 710   ("jdp.source_addr",
 711    "set com.sun.management.jdp.source_addr", "STRING", false),
 712 
 713    _jdp_ttl
 714   ("jdp.ttl",
 715    "set com.sun.management.jdp.ttl", "INT", false),
 716 
 717    _jdp_pause
 718   ("jdp.pause",
 719    "set com.sun.management.jdp.pause", "INT", false),
 720 
 721    _jdp_name
 722   ("jdp.name",
 723    "set com.sun.management.jdp.name", "STRING", false)
 724 
 725   {
 726     _dcmdparser.add_dcmd_option(&_config_file);
 727     _dcmdparser.add_dcmd_option(&_jmxremote_host);
 728     _dcmdparser.add_dcmd_option(&_jmxremote_port);
 729     _dcmdparser.add_dcmd_option(&_jmxremote_rmi_port);
 730     _dcmdparser.add_dcmd_option(&_jmxremote_ssl);
 731     _dcmdparser.add_dcmd_option(&_jmxremote_registry_ssl);
 732     _dcmdparser.add_dcmd_option(&_jmxremote_authenticate);
 733     _dcmdparser.add_dcmd_option(&_jmxremote_password_file);
 734     _dcmdparser.add_dcmd_option(&_jmxremote_access_file);
 735     _dcmdparser.add_dcmd_option(&_jmxremote_login_config);
 736     _dcmdparser.add_dcmd_option(&_jmxremote_ssl_enabled_cipher_suites);
 737     _dcmdparser.add_dcmd_option(&_jmxremote_ssl_enabled_protocols);
 738     _dcmdparser.add_dcmd_option(&_jmxremote_ssl_need_client_auth);
 739     _dcmdparser.add_dcmd_option(&_jmxremote_ssl_config_file);
 740     _dcmdparser.add_dcmd_option(&_jmxremote_autodiscovery);
 741     _dcmdparser.add_dcmd_option(&_jdp_port);
 742     _dcmdparser.add_dcmd_option(&_jdp_address);
 743     _dcmdparser.add_dcmd_option(&_jdp_source_addr);
 744     _dcmdparser.add_dcmd_option(&_jdp_ttl);
 745     _dcmdparser.add_dcmd_option(&_jdp_pause);
 746     _dcmdparser.add_dcmd_option(&_jdp_name);
 747 }
 748 
 749 
 750 int JMXStartRemoteDCmd::num_arguments() {
 751   ResourceMark rm;
 752   JMXStartRemoteDCmd* dcmd = new JMXStartRemoteDCmd(NULL, false);
 753   if (dcmd != NULL) {
 754     DCmdMark mark(dcmd);
 755     return dcmd->_dcmdparser.num_arguments();
 756   } else {
 757     return 0;
 758   }
 759 }
 760 
 761 
 762 void JMXStartRemoteDCmd::execute(DCmdSource source, TRAPS) {
 763     ResourceMark rm(THREAD);
 764     HandleMark hm(THREAD);
 765 
 766     // Load and initialize the jdk.internal.agent.Agent class
 767     // invoke startRemoteManagementAgent(string) method to start
 768     // the remote management server.
 769     // throw java.lang.NoSuchMethodError if the method doesn't exist
 770 
 771     loadAgentModule(CHECK);
 772     Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
 773     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
 774 
 775     JavaValue result(T_VOID);
 776 
 777     // Pass all command line arguments to java as key=value,...
 778     // All checks are done on java side
 779 
 780     int len = 0;
 781     stringStream options;
 782     char comma[2] = {0,0};
 783 
 784     // Leave default values on Agent.class side and pass only
 785     // agruments explicitly set by user. All arguments passed
 786     // to jcmd override properties with the same name set by
 787     // command line with -D or by managmenent.properties
 788     // file.
 789 #define PUT_OPTION(a) \
 790     do { \
 791         if ( (a).is_set() ){ \
 792             if ( *((a).type()) == 'I' ) { \
 793                 options.print("%scom.sun.management.%s=" JLONG_FORMAT, comma, (a).name(), (jlong)((a).value())); \
 794             } else { \
 795                 options.print("%scom.sun.management.%s=%s", comma, (a).name(), (char*)((a).value())); \
 796             } \
 797             comma[0] = ','; \
 798         }\
 799     } while(0);
 800 
 801 
 802     PUT_OPTION(_config_file);
 803     PUT_OPTION(_jmxremote_host);
 804     PUT_OPTION(_jmxremote_port);
 805     PUT_OPTION(_jmxremote_rmi_port);
 806     PUT_OPTION(_jmxremote_ssl);
 807     PUT_OPTION(_jmxremote_registry_ssl);
 808     PUT_OPTION(_jmxremote_authenticate);
 809     PUT_OPTION(_jmxremote_password_file);
 810     PUT_OPTION(_jmxremote_access_file);
 811     PUT_OPTION(_jmxremote_login_config);
 812     PUT_OPTION(_jmxremote_ssl_enabled_cipher_suites);
 813     PUT_OPTION(_jmxremote_ssl_enabled_protocols);
 814     PUT_OPTION(_jmxremote_ssl_need_client_auth);
 815     PUT_OPTION(_jmxremote_ssl_config_file);
 816     PUT_OPTION(_jmxremote_autodiscovery);
 817     PUT_OPTION(_jdp_port);
 818     PUT_OPTION(_jdp_address);
 819     PUT_OPTION(_jdp_source_addr);
 820     PUT_OPTION(_jdp_ttl);
 821     PUT_OPTION(_jdp_pause);
 822     PUT_OPTION(_jdp_name);
 823 
 824 #undef PUT_OPTION
 825 
 826     Handle str = java_lang_String::create_from_str(options.as_string(), CHECK);
 827     JavaCalls::call_static(&result, k, vmSymbols::startRemoteAgent_name(), vmSymbols::string_void_signature(), str, CHECK);
 828 }
 829 
 830 JMXStartLocalDCmd::JMXStartLocalDCmd(outputStream *output, bool heap_allocated) :
 831   DCmd(output, heap_allocated) {
 832   // do nothing
 833 }
 834 
 835 void JMXStartLocalDCmd::execute(DCmdSource source, TRAPS) {
 836     ResourceMark rm(THREAD);
 837     HandleMark hm(THREAD);
 838 
 839     // Load and initialize the jdk.internal.agent.Agent class
 840     // invoke startLocalManagementAgent(void) method to start
 841     // the local management server
 842     // throw java.lang.NoSuchMethodError if method doesn't exist
 843 
 844     loadAgentModule(CHECK);
 845     Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
 846     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
 847 
 848     JavaValue result(T_VOID);
 849     JavaCalls::call_static(&result, k, vmSymbols::startLocalAgent_name(), vmSymbols::void_method_signature(), CHECK);
 850 }
 851 
 852 void JMXStopRemoteDCmd::execute(DCmdSource source, TRAPS) {
 853     ResourceMark rm(THREAD);
 854     HandleMark hm(THREAD);
 855 
 856     // Load and initialize the jdk.internal.agent.Agent class
 857     // invoke stopRemoteManagementAgent method to stop the
 858     // management server
 859     // throw java.lang.NoSuchMethodError if method doesn't exist
 860 
 861     loadAgentModule(CHECK);
 862     Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
 863     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
 864 
 865     JavaValue result(T_VOID);
 866     JavaCalls::call_static(&result, k, vmSymbols::stopRemoteAgent_name(), vmSymbols::void_method_signature(), CHECK);
 867 }
 868 
 869 JMXStatusDCmd::JMXStatusDCmd(outputStream *output, bool heap_allocated) :
 870   DCmd(output, heap_allocated) {
 871   // do nothing
 872 }
 873 
 874 void JMXStatusDCmd::execute(DCmdSource source, TRAPS) {
 875   ResourceMark rm(THREAD);
 876   HandleMark hm(THREAD);
 877 
 878   // Load and initialize the jdk.internal.agent.Agent class
 879   // invoke getManagementAgentStatus() method to generate the status info
 880   // throw java.lang.NoSuchMethodError if method doesn't exist
 881 
 882   loadAgentModule(CHECK);
 883   Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
 884   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
 885 
 886   JavaValue result(T_OBJECT);
 887   JavaCalls::call_static(&result, k, vmSymbols::getAgentStatus_name(), vmSymbols::void_string_signature(), CHECK);
 888 
 889   jvalue* jv = (jvalue*) result.get_value_addr();
 890   oop str = (oop) jv->l;
 891   if (str != NULL) {
 892       char* out = java_lang_String::as_utf8_string(str);
 893       if (out) {
 894           output()->print_cr("%s", out);
 895           return;
 896       }
 897   }
 898   output()->print_cr("Error obtaining management agent status");
 899 }
 900 
 901 VMDynamicLibrariesDCmd::VMDynamicLibrariesDCmd(outputStream *output, bool heap_allocated) :
 902   DCmd(output, heap_allocated) {
 903   // do nothing
 904 }
 905 
 906 void VMDynamicLibrariesDCmd::execute(DCmdSource source, TRAPS) {
 907   os::print_dll_info(output());
 908   output()->cr();
 909 }
 910 
 911 void CompileQueueDCmd::execute(DCmdSource source, TRAPS) {
 912   VM_PrintCompileQueue printCompileQueueOp(output());
 913   VMThread::execute(&printCompileQueueOp);
 914 }
 915 
 916 void CodeListDCmd::execute(DCmdSource source, TRAPS) {
 917   CodeCache::print_codelist(output());
 918 }
 919 
 920 void CodeCacheDCmd::execute(DCmdSource source, TRAPS) {
 921   CodeCache::print_layout(output());
 922 }
 923 
 924 //---<  BEGIN  >--- CodeHeap State Analytics.
 925 CodeHeapAnalyticsDCmd::CodeHeapAnalyticsDCmd(outputStream* output, bool heap) :
 926                                              DCmdWithParser(output, heap),
 927   _function("function", "Function to be performed (aggregate, UsedSpace, FreeSpace, MethodCount, MethodSpace, MethodAge, MethodNames, discard", "STRING", false, "all"),
 928   _granularity("granularity", "Detail level - smaller value -> more detail", "STRING", false, "4096") {
 929   _dcmdparser.add_dcmd_argument(&_function);
 930   _dcmdparser.add_dcmd_argument(&_granularity);
 931 }
 932 
 933 void CodeHeapAnalyticsDCmd::execute(DCmdSource source, TRAPS) {
 934   CompileBroker::print_heapinfo(output(), _function.value(), _granularity.value());
 935 }
 936 
 937 int CodeHeapAnalyticsDCmd::num_arguments() {
 938   ResourceMark rm;
 939   CodeHeapAnalyticsDCmd* dcmd = new CodeHeapAnalyticsDCmd(NULL, false);
 940   if (dcmd != NULL) {
 941     DCmdMark mark(dcmd);
 942     return dcmd->_dcmdparser.num_arguments();
 943   } else {
 944     return 0;
 945   }
 946 }
 947 //---<  END  >--- CodeHeap State Analytics.
 948 
 949 void CompilerDirectivesPrintDCmd::execute(DCmdSource source, TRAPS) {
 950   DirectivesStack::print(output());
 951 }
 952 
 953 CompilerDirectivesAddDCmd::CompilerDirectivesAddDCmd(outputStream* output, bool heap) :
 954                            DCmdWithParser(output, heap),
 955   _filename("filename","Name of the directives file", "STRING",true) {
 956   _dcmdparser.add_dcmd_argument(&_filename);
 957 }
 958 
 959 void CompilerDirectivesAddDCmd::execute(DCmdSource source, TRAPS) {
 960   DirectivesParser::parse_from_file(_filename.value(), output());
 961 }
 962 
 963 int CompilerDirectivesAddDCmd::num_arguments() {
 964   ResourceMark rm;
 965   CompilerDirectivesAddDCmd* dcmd = new CompilerDirectivesAddDCmd(NULL, false);
 966   if (dcmd != NULL) {
 967     DCmdMark mark(dcmd);
 968     return dcmd->_dcmdparser.num_arguments();
 969   } else {
 970     return 0;
 971   }
 972 }
 973 
 974 void CompilerDirectivesRemoveDCmd::execute(DCmdSource source, TRAPS) {
 975   DirectivesStack::pop(1);
 976 }
 977 
 978 void CompilerDirectivesClearDCmd::execute(DCmdSource source, TRAPS) {
 979   DirectivesStack::clear();
 980 }
 981 #if INCLUDE_SERVICES
 982 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
 983                                        DCmdWithParser(output, heap),
 984   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
 985   _print_subclasses("-s", "If a classname is specified, print its subclasses. "
 986                     "Otherwise only its superclasses are printed.", "BOOLEAN", false, "false"),
 987   _classname("classname", "Name of class whose hierarchy should be printed. "
 988              "If not specified, all class hierarchies are printed.",
 989              "STRING", false) {
 990   _dcmdparser.add_dcmd_option(&_print_interfaces);
 991   _dcmdparser.add_dcmd_option(&_print_subclasses);
 992   _dcmdparser.add_dcmd_argument(&_classname);
 993 }
 994 
 995 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
 996   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
 997                                                _print_subclasses.value(), _classname.value());
 998   VMThread::execute(&printClassHierarchyOp);
 999 }
1000 
1001 int ClassHierarchyDCmd::num_arguments() {
1002   ResourceMark rm;
1003   ClassHierarchyDCmd* dcmd = new ClassHierarchyDCmd(NULL, false);
1004   if (dcmd != NULL) {
1005     DCmdMark mark(dcmd);
1006     return dcmd->_dcmdparser.num_arguments();
1007   } else {
1008     return 0;
1009   }
1010 }
1011 
1012 #endif
1013 
1014 class VM_DumpTouchedMethods : public VM_Operation {
1015 private:
1016   outputStream* _out;
1017 public:
1018   VM_DumpTouchedMethods(outputStream* out) {
1019     _out = out;
1020   }
1021 
1022   virtual VMOp_Type type() const { return VMOp_DumpTouchedMethods; }
1023 
1024   virtual void doit() {
1025     Method::print_touched_methods(_out);
1026   }
1027 };
1028 
1029 TouchedMethodsDCmd::TouchedMethodsDCmd(outputStream* output, bool heap) :
1030                                        DCmdWithParser(output, heap)
1031 {}
1032 
1033 void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) {
1034   if (!LogTouchedMethods) {
1035     output()->print_cr("VM.print_touched_methods command requires -XX:+LogTouchedMethods");
1036     return;
1037   }
1038   VM_DumpTouchedMethods dumper(output());
1039   VMThread::execute(&dumper);
1040 }
1041 
1042 int TouchedMethodsDCmd::num_arguments() {
1043   return 0;
1044 }