blob: 7d32cc6d08a56036cc23965a43689ea4badb4b75 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- CommandObjectLog.cpp ------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Daniel Malea93a64302012-12-05 00:20:57 +000010#include "lldb/lldb-python.h"
11
Chris Lattner30fdc8d2010-06-08 16:52:24 +000012#include "CommandObjectLog.h"
13
14// C Includes
15// C++ Includes
16// Other libraries and framework includes
17// Project includes
18#include "lldb/lldb-private-log.h"
19
Jim Ingham40af72e2010-06-15 19:49:27 +000020#include "lldb/Interpreter/Args.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000021#include "lldb/Core/Debugger.h"
Greg Clayton53239f02011-02-08 05:05:52 +000022#include "lldb/Host/FileSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000023#include "lldb/Core/Log.h"
24#include "lldb/Core/Module.h"
Jim Ingham40af72e2010-06-15 19:49:27 +000025#include "lldb/Interpreter/Options.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000026#include "lldb/Core/RegularExpression.h"
27#include "lldb/Core/Stream.h"
28#include "lldb/Core/StreamFile.h"
29#include "lldb/Core/Timer.h"
30
Greg Clayton66111032010-06-23 01:19:29 +000031#include "lldb/Core/Debugger.h"
Sean Callanan4be39902010-06-23 21:28:25 +000032#include "lldb/Interpreter/CommandInterpreter.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000033#include "lldb/Interpreter/CommandReturnObject.h"
34
35#include "lldb/Symbol/LineTable.h"
36#include "lldb/Symbol/ObjectFile.h"
37#include "lldb/Symbol/SymbolFile.h"
38#include "lldb/Symbol/SymbolVendor.h"
39
40#include "lldb/Target/Process.h"
41#include "lldb/Target/Target.h"
42
43using namespace lldb;
44using namespace lldb_private;
45
46
Jim Ingham5a988412012-06-08 21:56:10 +000047class CommandObjectLogEnable : public CommandObjectParsed
Chris Lattner30fdc8d2010-06-08 16:52:24 +000048{
49public:
50 //------------------------------------------------------------------
51 // Constructors and Destructors
52 //------------------------------------------------------------------
Greg Claytona7015092010-09-18 01:14:36 +000053 CommandObjectLogEnable(CommandInterpreter &interpreter) :
Jim Ingham5a988412012-06-08 21:56:10 +000054 CommandObjectParsed (interpreter,
55 "log enable",
56 "Enable logging for a single log channel.",
57 NULL),
Greg Claytoneb0103f2011-04-07 22:46:35 +000058 m_options (interpreter)
Chris Lattner30fdc8d2010-06-08 16:52:24 +000059 {
Caroline Ticeceb6b132010-10-26 03:11:13 +000060
61 CommandArgumentEntry arg1;
62 CommandArgumentEntry arg2;
Caroline Tice405fe672010-10-04 22:28:36 +000063 CommandArgumentData channel_arg;
Caroline Ticeceb6b132010-10-26 03:11:13 +000064 CommandArgumentData category_arg;
Caroline Tice405fe672010-10-04 22:28:36 +000065
66 // Define the first (and only) variant of this arg.
67 channel_arg.arg_type = eArgTypeLogChannel;
68 channel_arg.arg_repetition = eArgRepeatPlain;
69
70 // There is only one variant this argument could be; put it into the argument entry.
Caroline Ticeceb6b132010-10-26 03:11:13 +000071 arg1.push_back (channel_arg);
Caroline Tice405fe672010-10-04 22:28:36 +000072
Caroline Ticeceb6b132010-10-26 03:11:13 +000073 category_arg.arg_type = eArgTypeLogCategory;
74 category_arg.arg_repetition = eArgRepeatPlus;
75
76 arg2.push_back (category_arg);
77
Caroline Tice405fe672010-10-04 22:28:36 +000078 // Push the data for the first argument into the m_arguments vector.
Caroline Ticeceb6b132010-10-26 03:11:13 +000079 m_arguments.push_back (arg1);
80 m_arguments.push_back (arg2);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000081 }
82
83 virtual
84 ~CommandObjectLogEnable()
85 {
86 }
87
88 Options *
89 GetOptions ()
90 {
91 return &m_options;
92 }
93
Greg Claytonab65b342011-04-13 22:47:15 +000094// int
95// HandleArgumentCompletion (Args &input,
96// int &cursor_index,
97// int &cursor_char_position,
98// OptionElementVector &opt_element_vector,
99// int match_start_point,
100// int max_return_elements,
101// bool &word_complete,
102// StringList &matches)
103// {
104// std::string completion_str (input.GetArgumentAtIndex(cursor_index));
105// completion_str.erase (cursor_char_position);
106//
107// if (cursor_index == 1)
108// {
109// //
110// Log::AutoCompleteChannelName (completion_str.c_str(), matches);
111// }
112// return matches.GetSize();
113// }
114//
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000115
116 class CommandOptions : public Options
117 {
118 public:
119
Greg Claytoneb0103f2011-04-07 22:46:35 +0000120 CommandOptions (CommandInterpreter &interpreter) :
121 Options (interpreter),
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000122 log_file (),
123 log_options (0)
124 {
125 }
126
127
128 virtual
129 ~CommandOptions ()
130 {
131 }
132
133 virtual Error
Greg Claytonf6b8b582011-04-13 00:18:08 +0000134 SetOptionValue (uint32_t option_idx, const char *option_arg)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000135 {
136 Error error;
Greg Clayton3bcdfc02012-12-04 00:32:51 +0000137 const int short_option = m_getopt_table[option_idx].val;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000138
139 switch (short_option)
140 {
Greg Clayton889037d2012-12-07 18:37:09 +0000141 case 'f': log_file.SetFile(option_arg, true); break;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000142 case 't': log_options |= LLDB_LOG_OPTION_THREADSAFE; break;
143 case 'v': log_options |= LLDB_LOG_OPTION_VERBOSE; break;
144 case 'g': log_options |= LLDB_LOG_OPTION_DEBUG; break;
145 case 's': log_options |= LLDB_LOG_OPTION_PREPEND_SEQUENCE; break;
146 case 'T': log_options |= LLDB_LOG_OPTION_PREPEND_TIMESTAMP; break;
147 case 'p': log_options |= LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD;break;
148 case 'n': log_options |= LLDB_LOG_OPTION_PREPEND_THREAD_NAME; break;
Greg Clayton3a18e312012-10-08 22:41:53 +0000149 case 'S': log_options |= LLDB_LOG_OPTION_BACKTRACE; break;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000150 default:
Greg Clayton86edbf42011-10-26 00:56:27 +0000151 error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000152 break;
153 }
154
155 return error;
156 }
157
158 void
Greg Claytonf6b8b582011-04-13 00:18:08 +0000159 OptionParsingStarting ()
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000160 {
Greg Clayton889037d2012-12-07 18:37:09 +0000161 log_file.Clear();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000162 log_options = 0;
163 }
164
Greg Claytone0d378b2011-03-24 21:19:54 +0000165 const OptionDefinition*
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000166 GetDefinitions ()
167 {
168 return g_option_table;
169 }
170
171 // Options table: Required for subclasses of Options.
172
Greg Claytone0d378b2011-03-24 21:19:54 +0000173 static OptionDefinition g_option_table[];
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000174
175 // Instance variables to hold the values for command options.
176
Greg Clayton889037d2012-12-07 18:37:09 +0000177 FileSpec log_file;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000178 uint32_t log_options;
179 };
180
181protected:
Jim Ingham5a988412012-06-08 21:56:10 +0000182 virtual bool
183 DoExecute (Args& args,
184 CommandReturnObject &result)
185 {
186 if (args.GetArgumentCount() < 2)
187 {
188 result.AppendErrorWithFormat("%s takes a log channel and one or more log types.\n", m_cmd_name.c_str());
189 }
190 else
191 {
192 std::string channel(args.GetArgumentAtIndex(0));
193 args.Shift (); // Shift off the channel
Greg Clayton889037d2012-12-07 18:37:09 +0000194 char log_file[PATH_MAX];
195 if (m_options.log_file)
196 m_options.log_file.GetPath(log_file, sizeof(log_file));
197 else
198 log_file[0] = '\0';
Jim Ingham5a988412012-06-08 21:56:10 +0000199 bool success = m_interpreter.GetDebugger().EnableLog (channel.c_str(),
200 args.GetConstArgumentVector(),
Greg Clayton889037d2012-12-07 18:37:09 +0000201 log_file,
Jim Ingham5a988412012-06-08 21:56:10 +0000202 m_options.log_options,
203 result.GetErrorStream());
204 if (success)
205 result.SetStatus (eReturnStatusSuccessFinishNoResult);
206 else
207 result.SetStatus (eReturnStatusFailed);
208 }
209 return result.Succeeded();
210 }
211
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000212 CommandOptions m_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000213};
214
Greg Claytone0d378b2011-03-24 21:19:54 +0000215OptionDefinition
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000216CommandObjectLogEnable::CommandOptions::g_option_table[] =
217{
Zachary Turnerd37221d2014-07-09 16:31:49 +0000218{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFilename, "Set the destination file to log to."},
219{ LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable thread safe logging to avoid interweaved log lines." },
220{ LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable verbose logging." },
221{ LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable debug logging." },
222{ LLDB_OPT_SET_1, false, "sequence", 's', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with an increasing integer sequence id." },
223{ LLDB_OPT_SET_1, false, "timestamp", 'T', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with a timestamp." },
224{ LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
225{ LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
226{ LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
227{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000228};
229
Jim Ingham5a988412012-06-08 21:56:10 +0000230class CommandObjectLogDisable : public CommandObjectParsed
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000231{
232public:
233 //------------------------------------------------------------------
234 // Constructors and Destructors
235 //------------------------------------------------------------------
Greg Claytona7015092010-09-18 01:14:36 +0000236 CommandObjectLogDisable(CommandInterpreter &interpreter) :
Jim Ingham5a988412012-06-08 21:56:10 +0000237 CommandObjectParsed (interpreter,
238 "log disable",
239 "Disable one or more log channel categories.",
240 NULL)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000241 {
Caroline Tice7149fab2010-10-29 21:56:41 +0000242 CommandArgumentEntry arg1;
243 CommandArgumentEntry arg2;
Caroline Tice405fe672010-10-04 22:28:36 +0000244 CommandArgumentData channel_arg;
Caroline Tice7149fab2010-10-29 21:56:41 +0000245 CommandArgumentData category_arg;
Caroline Tice405fe672010-10-04 22:28:36 +0000246
247 // Define the first (and only) variant of this arg.
248 channel_arg.arg_type = eArgTypeLogChannel;
Caroline Tice7149fab2010-10-29 21:56:41 +0000249 channel_arg.arg_repetition = eArgRepeatPlain;
Caroline Tice405fe672010-10-04 22:28:36 +0000250
251 // There is only one variant this argument could be; put it into the argument entry.
Caroline Tice7149fab2010-10-29 21:56:41 +0000252 arg1.push_back (channel_arg);
Caroline Tice405fe672010-10-04 22:28:36 +0000253
Caroline Tice7149fab2010-10-29 21:56:41 +0000254 category_arg.arg_type = eArgTypeLogCategory;
255 category_arg.arg_repetition = eArgRepeatPlus;
256
257 arg2.push_back (category_arg);
258
Caroline Tice405fe672010-10-04 22:28:36 +0000259 // Push the data for the first argument into the m_arguments vector.
Caroline Tice7149fab2010-10-29 21:56:41 +0000260 m_arguments.push_back (arg1);
261 m_arguments.push_back (arg2);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000262 }
263
264 virtual
265 ~CommandObjectLogDisable()
266 {
267 }
268
Jim Ingham5a988412012-06-08 21:56:10 +0000269protected:
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000270 virtual bool
Jim Ingham5a988412012-06-08 21:56:10 +0000271 DoExecute (Args& args,
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000272 CommandReturnObject &result)
273 {
274 const size_t argc = args.GetArgumentCount();
275 if (argc == 0)
276 {
Jim Inghamdff04402012-05-12 00:38:30 +0000277 result.AppendErrorWithFormat("%s takes a log channel and one or more log types.\n", m_cmd_name.c_str());
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000278 }
279 else
280 {
Caroline Tice20ad3c42010-10-29 21:48:37 +0000281 Log::Callbacks log_callbacks;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000282
Caroline Tice20ad3c42010-10-29 21:48:37 +0000283 std::string channel(args.GetArgumentAtIndex(0));
284 args.Shift (); // Shift off the channel
Greg Clayton57abc5d2013-05-10 21:47:16 +0000285 if (Log::GetLogChannelCallbacks (ConstString(channel.c_str()), log_callbacks))
Caroline Tice20ad3c42010-10-29 21:48:37 +0000286 {
Jim Ingham228063c2012-02-21 02:23:08 +0000287 log_callbacks.disable (args.GetConstArgumentVector(), &result.GetErrorStream());
Caroline Tice20ad3c42010-10-29 21:48:37 +0000288 result.SetStatus(eReturnStatusSuccessFinishNoResult);
289 }
290 else if (channel == "all")
291 {
292 Log::DisableAllLogChannels(&result.GetErrorStream());
293 }
294 else
295 {
Greg Claytonab65b342011-04-13 22:47:15 +0000296 LogChannelSP log_channel_sp (LogChannel::FindPlugin(channel.c_str()));
Caroline Tice20ad3c42010-10-29 21:48:37 +0000297 if (log_channel_sp)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000298 {
Jim Ingham228063c2012-02-21 02:23:08 +0000299 log_channel_sp->Disable(args.GetConstArgumentVector(), &result.GetErrorStream());
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000300 result.SetStatus(eReturnStatusSuccessFinishNoResult);
301 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000302 else
Caroline Tice20ad3c42010-10-29 21:48:37 +0000303 result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0));
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000304 }
305 }
306 return result.Succeeded();
307 }
308};
309
Jim Ingham5a988412012-06-08 21:56:10 +0000310class CommandObjectLogList : public CommandObjectParsed
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000311{
312public:
313 //------------------------------------------------------------------
314 // Constructors and Destructors
315 //------------------------------------------------------------------
Greg Claytona7015092010-09-18 01:14:36 +0000316 CommandObjectLogList(CommandInterpreter &interpreter) :
Jim Ingham5a988412012-06-08 21:56:10 +0000317 CommandObjectParsed (interpreter,
318 "log list",
319 "List the log categories for one or more log channels. If none specified, lists them all.",
320 NULL)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000321 {
Caroline Tice405fe672010-10-04 22:28:36 +0000322 CommandArgumentEntry arg;
323 CommandArgumentData channel_arg;
324
325 // Define the first (and only) variant of this arg.
326 channel_arg.arg_type = eArgTypeLogChannel;
327 channel_arg.arg_repetition = eArgRepeatStar;
328
329 // There is only one variant this argument could be; put it into the argument entry.
330 arg.push_back (channel_arg);
331
332 // Push the data for the first argument into the m_arguments vector.
333 m_arguments.push_back (arg);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000334 }
335
336 virtual
337 ~CommandObjectLogList()
338 {
339 }
340
Jim Ingham5a988412012-06-08 21:56:10 +0000341protected:
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000342 virtual bool
Jim Ingham5a988412012-06-08 21:56:10 +0000343 DoExecute (Args& args,
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000344 CommandReturnObject &result)
345 {
346 const size_t argc = args.GetArgumentCount();
347 if (argc == 0)
348 {
349 Log::ListAllLogChannels (&result.GetOutputStream());
350 result.SetStatus(eReturnStatusSuccessFinishResult);
351 }
352 else
353 {
354 for (size_t i=0; i<argc; ++i)
355 {
356 Log::Callbacks log_callbacks;
357
358 std::string channel(args.GetArgumentAtIndex(i));
Greg Clayton57abc5d2013-05-10 21:47:16 +0000359 if (Log::GetLogChannelCallbacks (ConstString(channel.c_str()), log_callbacks))
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000360 {
361 log_callbacks.list_categories (&result.GetOutputStream());
362 result.SetStatus(eReturnStatusSuccessFinishResult);
363 }
364 else if (channel == "all")
365 {
366 Log::ListAllLogChannels (&result.GetOutputStream());
367 result.SetStatus(eReturnStatusSuccessFinishResult);
368 }
369 else
370 {
Greg Claytonab65b342011-04-13 22:47:15 +0000371 LogChannelSP log_channel_sp (LogChannel::FindPlugin(channel.c_str()));
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000372 if (log_channel_sp)
373 {
374 log_channel_sp->ListCategories(&result.GetOutputStream());
375 result.SetStatus(eReturnStatusSuccessFinishNoResult);
376 }
377 else
378 result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0));
379 }
380 }
381 }
382 return result.Succeeded();
383 }
384};
385
Jim Ingham5a988412012-06-08 21:56:10 +0000386class CommandObjectLogTimer : public CommandObjectParsed
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000387{
388public:
389 //------------------------------------------------------------------
390 // Constructors and Destructors
391 //------------------------------------------------------------------
Greg Claytona7015092010-09-18 01:14:36 +0000392 CommandObjectLogTimer(CommandInterpreter &interpreter) :
Jim Ingham5a988412012-06-08 21:56:10 +0000393 CommandObjectParsed (interpreter,
394 "log timers",
395 "Enable, disable, dump, and reset LLDB internal performance timers.",
396 "log timers < enable <depth> | disable | dump | increment <bool> | reset >")
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000397 {
398 }
399
400 virtual
401 ~CommandObjectLogTimer()
402 {
403 }
404
Jim Ingham5a988412012-06-08 21:56:10 +0000405protected:
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000406 virtual bool
Jim Ingham5a988412012-06-08 21:56:10 +0000407 DoExecute (Args& args,
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000408 CommandReturnObject &result)
409 {
410 const size_t argc = args.GetArgumentCount();
411 result.SetStatus(eReturnStatusFailed);
412
413 if (argc == 1)
414 {
415 const char *sub_command = args.GetArgumentAtIndex(0);
416
417 if (strcasecmp(sub_command, "enable") == 0)
418 {
419 Timer::SetDisplayDepth (UINT32_MAX);
420 result.SetStatus(eReturnStatusSuccessFinishNoResult);
421 }
422 else if (strcasecmp(sub_command, "disable") == 0)
423 {
424 Timer::DumpCategoryTimes (&result.GetOutputStream());
425 Timer::SetDisplayDepth (0);
426 result.SetStatus(eReturnStatusSuccessFinishResult);
427 }
428 else if (strcasecmp(sub_command, "dump") == 0)
429 {
430 Timer::DumpCategoryTimes (&result.GetOutputStream());
431 result.SetStatus(eReturnStatusSuccessFinishResult);
432 }
433 else if (strcasecmp(sub_command, "reset") == 0)
434 {
435 Timer::ResetCategoryTimes ();
436 result.SetStatus(eReturnStatusSuccessFinishResult);
437 }
438
439 }
Jim Ingham932725f2010-11-04 23:08:26 +0000440 else if (argc == 2)
441 {
442 const char *sub_command = args.GetArgumentAtIndex(0);
443
444 if (strcasecmp(sub_command, "enable") == 0)
445 {
446 bool success;
447 uint32_t depth = Args::StringToUInt32(args.GetArgumentAtIndex(1), 0, 0, &success);
448 if (success)
449 {
450 Timer::SetDisplayDepth (depth);
451 result.SetStatus(eReturnStatusSuccessFinishNoResult);
452 }
453 else
454 result.AppendError("Could not convert enable depth to an unsigned integer.");
455 }
Jim Inghamf7f4f502010-11-04 23:19:21 +0000456 if (strcasecmp(sub_command, "increment") == 0)
457 {
458 bool success;
459 bool increment = Args::StringToBoolean(args.GetArgumentAtIndex(1), false, &success);
460 if (success)
461 {
462 Timer::SetQuiet (!increment);
463 result.SetStatus(eReturnStatusSuccessFinishNoResult);
464 }
465 else
466 result.AppendError("Could not convert increment value to boolean.");
467 }
Jim Ingham932725f2010-11-04 23:08:26 +0000468 }
469
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000470 if (!result.Succeeded())
471 {
472 result.AppendError("Missing subcommand");
473 result.AppendErrorWithFormat("Usage: %s\n", m_cmd_syntax.c_str());
474 }
475 return result.Succeeded();
476 }
477};
478
479//----------------------------------------------------------------------
480// CommandObjectLog constructor
481//----------------------------------------------------------------------
Greg Clayton66111032010-06-23 01:19:29 +0000482CommandObjectLog::CommandObjectLog(CommandInterpreter &interpreter) :
Greg Claytona7015092010-09-18 01:14:36 +0000483 CommandObjectMultiword (interpreter,
484 "log",
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000485 "A set of commands for operating on logs.",
486 "log <command> [<command-options>]")
487{
Greg Claytona7015092010-09-18 01:14:36 +0000488 LoadSubCommand ("enable", CommandObjectSP (new CommandObjectLogEnable (interpreter)));
489 LoadSubCommand ("disable", CommandObjectSP (new CommandObjectLogDisable (interpreter)));
490 LoadSubCommand ("list", CommandObjectSP (new CommandObjectLogList (interpreter)));
491 LoadSubCommand ("timers", CommandObjectSP (new CommandObjectLogTimer (interpreter)));
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000492}
493
494//----------------------------------------------------------------------
495// Destructor
496//----------------------------------------------------------------------
497CommandObjectLog::~CommandObjectLog()
498{
499}
500
501
502
503