1 /*
   2  * Copyright (c) 2011, 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 #ifndef SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
  26 #define SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
  27 
  28 #include "runtime/arguments.hpp"
  29 #include "classfile/vmSymbols.hpp"
  30 #include "utilities/ostream.hpp"
  31 #include "runtime/vm_version.hpp"
  32 #include "runtime/vmThread.hpp"
  33 #include "runtime/os.hpp"
  34 #include "services/diagnosticArgument.hpp"
  35 #include "services/diagnosticFramework.hpp"
  36 #include "services/diagnosticCommand.hpp"
  37 
  38 class HelpDCmd : public DCmd {
  39 protected:
  40   DCmdParser _dcmdparser;
  41   DCmdArgument<bool> _all;
  42   DCmdArgument<char*> _cmd;
  43 public:
  44   HelpDCmd(outputStream* output, bool heap=false);
  45   static const char* get_name() { return "help"; }
  46   static const char* get_description() {
  47     return "For more information about a specific command use 'help <command>'. "
  48            "With no argument this will show a list of available commands. "
  49            "'help all' will show help for all commands.";
  50   }
  51   static const char* get_impact() { return "Low: "; }
  52   static int get_num_arguments();
  53   virtual void parse(CmdLine* line, char delim, TRAPS);
  54   virtual void execute(TRAPS);
  55   virtual void reset(TRAPS);
  56   virtual void cleanup();
  57   virtual void print_help(outputStream* out);
  58   virtual GrowableArray<const char*>* get_argument_name_array();
  59   virtual GrowableArray<DCmdArgumentInfo*>* get_argument_info_array();
  60 };
  61 
  62 class VersionDCmd : public DCmd {
  63 public:
  64   VersionDCmd(outputStream* output, bool heap=false) : DCmd(output,heap) { }
  65   static const char* get_name() { return "VM.version"; }
  66   static const char* get_description() {
  67     return "Print JVM version information.";
  68   }
  69   static const char* get_impact() { return "Low: "; }
  70   static int get_num_arguments() { return 0; }
  71   virtual void parse(CmdLine* line, char delim, TRAPS) { }
  72   virtual void execute(TRAPS);
  73   virtual void print_help(outputStream* out) { }
  74 };
  75 
  76 #endif // SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP