comparison src/share/vm/services/diagnosticFramework.hpp @ 4773:4f25538b54c9

7120511: Add diagnostic commands Reviewed-by: acorn, phh, dcubed, sspitsyn
author fparain
date Mon, 09 Jan 2012 10:27:24 +0100
parents 3b688d6ff3d0
children a42c07c38c47
comparison
equal deleted inserted replaced
4754:66259eca2bf7 4773:4f25538b54c9
239 static const char* disabled_message() { return "Diagnostic command currently disabled"; } 239 static const char* disabled_message() { return "Diagnostic command currently disabled"; }
240 static const char* impact() { return "Low: No impact"; } 240 static const char* impact() { return "Low: No impact"; }
241 static int num_arguments() { return 0; } 241 static int num_arguments() { return 0; }
242 outputStream* output() { return _output; } 242 outputStream* output() { return _output; }
243 bool is_heap_allocated() { return _is_heap_allocated; } 243 bool is_heap_allocated() { return _is_heap_allocated; }
244 virtual void print_help(outputStream* out) { }; 244 virtual void print_help(const char* name) {
245 virtual void parse(CmdLine* line, char delim, TRAPS) { } 245 output()->print_cr("Syntax: %s", name);
246 }
247 virtual void parse(CmdLine* line, char delim, TRAPS) {
248 DCmdArgIter iter(line->args_addr(), line->args_len(), delim);
249 bool has_arg = iter.next(CHECK);
250 if (has_arg) {
251 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
252 "Unknown argument in diagnostic command");
253 }
254 }
246 virtual void execute(TRAPS) { } 255 virtual void execute(TRAPS) { }
247 virtual void reset(TRAPS) { } 256 virtual void reset(TRAPS) { }
248 virtual void cleanup() { } 257 virtual void cleanup() { }
249 258
250 // support for the JMX interface 259 // support for the JMX interface
258 } 267 }
259 268
260 // main method to invoke the framework 269 // main method to invoke the framework
261 static void parse_and_execute(outputStream* out, const char* cmdline, 270 static void parse_and_execute(outputStream* out, const char* cmdline,
262 char delim, TRAPS); 271 char delim, TRAPS);
272 };
273
274 class DCmdWithParser : public DCmd {
275 protected:
276 DCmdParser _dcmdparser;
277 public:
278 DCmdWithParser (outputStream *output, bool heap=false) : DCmd(output, heap) { }
279 static const char* name() { return "No Name";}
280 static const char* description() { return "No Help";}
281 static const char* disabled_message() { return "Diagnostic command currently disabled"; }
282 static const char* impact() { return "Low: No impact"; }
283 static int num_arguments() { return 0; }
284 virtual void parse(CmdLine *line, char delim, TRAPS);
285 virtual void execute(TRAPS) { }
286 virtual void reset(TRAPS);
287 virtual void cleanup();
288 virtual void print_help(const char* name);
289 virtual GrowableArray<const char*>* argument_name_array();
290 virtual GrowableArray<DCmdArgumentInfo*>* argument_info_array();
263 }; 291 };
264 292
265 class DCmdMark : public StackObj { 293 class DCmdMark : public StackObj {
266 DCmd* _ref; 294 DCmd* _ref;
267 public: 295 public: