2010-06-09 00:52:24 +08:00
//===-- CommandObjectLog.cpp ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
2016-02-20 08:58:29 +08:00
# include "CommandObjectLog.h"
2010-06-09 00:52:24 +08:00
# include "lldb/Core/Debugger.h"
# include "lldb/Core/Module.h"
# include "lldb/Core/StreamFile.h"
2017-03-23 07:33:16 +08:00
# include "lldb/Host/OptionParser.h"
2016-09-07 04:57:50 +08:00
# include "lldb/Interpreter/Args.h"
2010-06-24 05:28:25 +08:00
# include "lldb/Interpreter/CommandInterpreter.h"
2010-06-09 00:52:24 +08:00
# include "lldb/Interpreter/CommandReturnObject.h"
2016-09-07 04:57:50 +08:00
# include "lldb/Interpreter/Options.h"
2010-06-09 00:52:24 +08:00
# include "lldb/Symbol/LineTable.h"
# include "lldb/Symbol/ObjectFile.h"
# include "lldb/Symbol/SymbolFile.h"
# include "lldb/Symbol/SymbolVendor.h"
# include "lldb/Target/Process.h"
# include "lldb/Target/Target.h"
2017-03-23 02:40:07 +08:00
# include "lldb/Utility/FileSpec.h"
2017-03-04 04:56:28 +08:00
# include "lldb/Utility/Log.h"
2017-02-03 05:39:50 +08:00
# include "lldb/Utility/RegularExpression.h"
# include "lldb/Utility/Stream.h"
2017-06-29 22:32:17 +08:00
# include "lldb/Utility/Timer.h"
2010-06-09 00:52:24 +08:00
using namespace lldb ;
using namespace lldb_private ;
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
static OptionDefinition g_log_options [ ] = {
// clang-format off
{ LLDB_OPT_SET_1 , false , " file " , ' f ' , OptionParser : : eRequiredArgument , nullptr , nullptr , 0 , eArgTypeFilename , " Set the destination file to log to. " } ,
{ LLDB_OPT_SET_1 , false , " threadsafe " , ' t ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Enable thread safe logging to avoid interweaved log lines. " } ,
{ LLDB_OPT_SET_1 , false , " verbose " , ' v ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Enable verbose logging. " } ,
{ LLDB_OPT_SET_1 , false , " sequence " , ' s ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Prepend all log lines with an increasing integer sequence id. " } ,
{ LLDB_OPT_SET_1 , false , " timestamp " , ' T ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Prepend all log lines with a timestamp. " } ,
{ LLDB_OPT_SET_1 , false , " pid-tid " , ' p ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Prepend all log lines with the process and thread ID that generates the log line. " } ,
{ LLDB_OPT_SET_1 , false , " thread-name " , ' n ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Prepend all log lines with the thread name for the thread that generates the log line. " } ,
{ LLDB_OPT_SET_1 , false , " stack " , ' S ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Append a stack backtrace to each log line. " } ,
{ LLDB_OPT_SET_1 , false , " append " , ' a ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Append to the log file instead of overwriting. " } ,
Add a more succinct logging syntax
This adds the LLDB_LOG macro, which enables one to write more succinct log
statements.
if (log)
log->Printf("log something: %d", var);
becomes
LLDB_LOG(log, "log something: {0}, var);
The macro still internally does the "if(log)" dance, so the arguments are only
evaluated if logging is enabled, meaning it has the same overhead as the
previous syntax.
Additionally, the log statements will be automatically prefixed with the file
and function generating the log (if the corresponding new argument to the "log
enable" command is enabled), so one does not need to manually specify this in
the log statement.
It also uses the new llvm formatv syntax, which means we don't have to worry
about PRIx64 macros and similar, and we can log complex object (llvm::StringRef,
lldb_private::Error, ...) more easily.
Differential Revision: https://reviews.llvm.org/D27459
llvm-svn: 292360
2017-01-18 19:00:26 +08:00
{ LLDB_OPT_SET_1 , false , " file-function " , ' F ' , OptionParser : : eNoArgument , nullptr , nullptr , 0 , eArgTypeNone , " Prepend the names of files and function that generate the logs. " } ,
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
// clang-format on
} ;
2016-09-07 04:57:50 +08:00
class CommandObjectLogEnable : public CommandObjectParsed {
2010-06-09 00:52:24 +08:00
public :
2016-09-07 04:57:50 +08:00
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogEnable ( CommandInterpreter & interpreter )
: CommandObjectParsed ( interpreter , " log enable " ,
2016-02-20 08:58:29 +08:00
" Enable logging for a single log channel. " ,
nullptr ) ,
2016-09-07 04:57:50 +08:00
m_options ( ) {
CommandArgumentEntry arg1 ;
CommandArgumentEntry arg2 ;
CommandArgumentData channel_arg ;
CommandArgumentData category_arg ;
// Define the first (and only) variant of this arg.
channel_arg . arg_type = eArgTypeLogChannel ;
channel_arg . arg_repetition = eArgRepeatPlain ;
// There is only one variant this argument could be; put it into the
// argument entry.
arg1 . push_back ( channel_arg ) ;
category_arg . arg_type = eArgTypeLogCategory ;
category_arg . arg_repetition = eArgRepeatPlus ;
arg2 . push_back ( category_arg ) ;
// Push the data for the first argument into the m_arguments vector.
m_arguments . push_back ( arg1 ) ;
m_arguments . push_back ( arg2 ) ;
}
~ CommandObjectLogEnable ( ) override = default ;
Options * GetOptions ( ) override { return & m_options ; }
class CommandOptions : public Options {
public :
CommandOptions ( ) : Options ( ) , log_file ( ) , log_options ( 0 ) { }
~ CommandOptions ( ) override = default ;
2017-05-12 12:51:55 +08:00
Status SetOptionValue ( uint32_t option_idx , llvm : : StringRef option_arg ,
ExecutionContext * execution_context ) override {
Status error ;
2016-09-07 04:57:50 +08:00
const int short_option = m_getopt_table [ option_idx ] . val ;
switch ( short_option ) {
case ' f ' :
log_file . SetFile ( option_arg , true ) ;
break ;
case ' t ' :
log_options | = LLDB_LOG_OPTION_THREADSAFE ;
break ;
case ' v ' :
log_options | = LLDB_LOG_OPTION_VERBOSE ;
break ;
case ' s ' :
log_options | = LLDB_LOG_OPTION_PREPEND_SEQUENCE ;
break ;
case ' T ' :
log_options | = LLDB_LOG_OPTION_PREPEND_TIMESTAMP ;
break ;
case ' p ' :
log_options | = LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD ;
break ;
case ' n ' :
log_options | = LLDB_LOG_OPTION_PREPEND_THREAD_NAME ;
break ;
case ' S ' :
log_options | = LLDB_LOG_OPTION_BACKTRACE ;
break ;
case ' a ' :
log_options | = LLDB_LOG_OPTION_APPEND ;
break ;
Add a more succinct logging syntax
This adds the LLDB_LOG macro, which enables one to write more succinct log
statements.
if (log)
log->Printf("log something: %d", var);
becomes
LLDB_LOG(log, "log something: {0}, var);
The macro still internally does the "if(log)" dance, so the arguments are only
evaluated if logging is enabled, meaning it has the same overhead as the
previous syntax.
Additionally, the log statements will be automatically prefixed with the file
and function generating the log (if the corresponding new argument to the "log
enable" command is enabled), so one does not need to manually specify this in
the log statement.
It also uses the new llvm formatv syntax, which means we don't have to worry
about PRIx64 macros and similar, and we can log complex object (llvm::StringRef,
lldb_private::Error, ...) more easily.
Differential Revision: https://reviews.llvm.org/D27459
llvm-svn: 292360
2017-01-18 19:00:26 +08:00
case ' F ' :
log_options | = LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION ;
2017-02-04 04:26:57 +08:00
break ;
2016-09-07 04:57:50 +08:00
default :
error . SetErrorStringWithFormat ( " unrecognized option '%c' " ,
short_option ) ;
break ;
}
return error ;
2010-06-09 00:52:24 +08:00
}
2016-09-07 04:57:50 +08:00
void OptionParsingStarting ( ExecutionContext * execution_context ) override {
log_file . Clear ( ) ;
log_options = 0 ;
2010-06-09 00:52:24 +08:00
}
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
llvm : : ArrayRef < OptionDefinition > GetDefinitions ( ) override {
2016-09-23 05:06:13 +08:00
return llvm : : makeArrayRef ( g_log_options ) ;
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
}
2010-06-09 00:52:24 +08:00
2016-09-07 04:57:50 +08:00
// Instance variables to hold the values for command options.
2010-06-09 00:52:24 +08:00
2016-09-07 04:57:50 +08:00
FileSpec log_file ;
uint32_t log_options ;
} ;
2010-06-09 00:52:24 +08:00
protected :
2016-09-07 04:57:50 +08:00
bool DoExecute ( Args & args , CommandReturnObject & result ) override {
if ( args . GetArgumentCount ( ) < 2 ) {
result . AppendErrorWithFormat (
" %s takes a log channel and one or more log types. \n " ,
m_cmd_name . c_str ( ) ) ;
2016-10-06 04:03:37 +08:00
return false ;
2012-06-09 05:56:10 +08:00
}
2016-10-06 04:03:37 +08:00
// Store into a std::string since we're about to shift the channel off.
2016-12-09 09:08:29 +08:00
const std : : string channel = args [ 0 ] . ref ;
2016-10-06 04:03:37 +08:00
args . Shift ( ) ; // Shift off the channel
char log_file [ PATH_MAX ] ;
if ( m_options . log_file )
m_options . log_file . GetPath ( log_file , sizeof ( log_file ) ) ;
else
log_file [ 0 ] = ' \0 ' ;
2017-03-15 17:06:58 +08:00
std : : string error ;
llvm : : raw_string_ostream error_stream ( error ) ;
2016-10-06 04:03:37 +08:00
bool success = m_interpreter . GetDebugger ( ) . EnableLog (
2017-03-01 18:08:40 +08:00
channel , args . GetArgumentArrayRef ( ) , log_file , m_options . log_options ,
2017-03-15 17:06:58 +08:00
error_stream ) ;
result . GetErrorStream ( ) < < error_stream . str ( ) ;
2016-10-06 04:03:37 +08:00
if ( success )
result . SetStatus ( eReturnStatusSuccessFinishNoResult ) ;
else
result . SetStatus ( eReturnStatusFailed ) ;
2016-09-07 04:57:50 +08:00
return result . Succeeded ( ) ;
}
2012-06-09 05:56:10 +08:00
2016-09-07 04:57:50 +08:00
CommandOptions m_options ;
2010-06-09 00:52:24 +08:00
} ;
2016-09-07 04:57:50 +08:00
class CommandObjectLogDisable : public CommandObjectParsed {
2010-06-09 00:52:24 +08:00
public :
2016-09-07 04:57:50 +08:00
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogDisable ( CommandInterpreter & interpreter )
: CommandObjectParsed ( interpreter , " log disable " ,
2016-02-20 08:58:29 +08:00
" Disable one or more log channel categories. " ,
2016-09-07 04:57:50 +08:00
nullptr ) {
CommandArgumentEntry arg1 ;
CommandArgumentEntry arg2 ;
CommandArgumentData channel_arg ;
CommandArgumentData category_arg ;
// Define the first (and only) variant of this arg.
channel_arg . arg_type = eArgTypeLogChannel ;
channel_arg . arg_repetition = eArgRepeatPlain ;
// There is only one variant this argument could be; put it into the
// argument entry.
arg1 . push_back ( channel_arg ) ;
category_arg . arg_type = eArgTypeLogCategory ;
category_arg . arg_repetition = eArgRepeatPlus ;
2010-06-09 00:52:24 +08:00
2016-09-07 04:57:50 +08:00
arg2 . push_back ( category_arg ) ;
// Push the data for the first argument into the m_arguments vector.
m_arguments . push_back ( arg1 ) ;
m_arguments . push_back ( arg2 ) ;
}
~ CommandObjectLogDisable ( ) override = default ;
2010-06-09 00:52:24 +08:00
2012-06-09 05:56:10 +08:00
protected :
2016-09-07 04:57:50 +08:00
bool DoExecute ( Args & args , CommandReturnObject & result ) override {
2016-10-06 04:03:37 +08:00
if ( args . empty ( ) ) {
2016-09-07 04:57:50 +08:00
result . AppendErrorWithFormat (
" %s takes a log channel and one or more log types. \n " ,
m_cmd_name . c_str ( ) ) ;
2016-10-06 04:03:37 +08:00
return false ;
}
2016-12-09 09:08:29 +08:00
const std : : string channel = args [ 0 ] . ref ;
2016-10-06 04:03:37 +08:00
args . Shift ( ) ; // Shift off the channel
2017-02-17 21:27:42 +08:00
if ( channel = = " all " ) {
2017-03-15 17:06:58 +08:00
Log : : DisableAllLogChannels ( ) ;
2017-02-17 21:27:42 +08:00
result . SetStatus ( eReturnStatusSuccessFinishNoResult ) ;
2016-09-07 04:57:50 +08:00
} else {
2017-03-15 17:06:58 +08:00
std : : string error ;
llvm : : raw_string_ostream error_stream ( error ) ;
2017-03-01 18:08:40 +08:00
if ( Log : : DisableLogChannel ( channel , args . GetArgumentArrayRef ( ) ,
2017-03-15 17:06:58 +08:00
error_stream ) )
2016-09-07 04:57:50 +08:00
result . SetStatus ( eReturnStatusSuccessFinishNoResult ) ;
2017-03-15 17:06:58 +08:00
result . GetErrorStream ( ) < < error_stream . str ( ) ;
2010-06-09 00:52:24 +08:00
}
2016-09-07 04:57:50 +08:00
return result . Succeeded ( ) ;
}
2010-06-09 00:52:24 +08:00
} ;
2016-09-07 04:57:50 +08:00
class CommandObjectLogList : public CommandObjectParsed {
2010-06-09 00:52:24 +08:00
public :
2016-09-07 04:57:50 +08:00
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogList ( CommandInterpreter & interpreter )
: CommandObjectParsed ( interpreter , " log list " ,
" List the log categories for one or more log "
" channels. If none specified, lists them all. " ,
nullptr ) {
CommandArgumentEntry arg ;
CommandArgumentData channel_arg ;
// Define the first (and only) variant of this arg.
channel_arg . arg_type = eArgTypeLogChannel ;
channel_arg . arg_repetition = eArgRepeatStar ;
// There is only one variant this argument could be; put it into the
// argument entry.
arg . push_back ( channel_arg ) ;
// Push the data for the first argument into the m_arguments vector.
m_arguments . push_back ( arg ) ;
}
~ CommandObjectLogList ( ) override = default ;
2010-06-09 00:52:24 +08:00
2012-06-09 05:56:10 +08:00
protected :
2016-09-07 04:57:50 +08:00
bool DoExecute ( Args & args , CommandReturnObject & result ) override {
2017-03-15 17:06:58 +08:00
std : : string output ;
llvm : : raw_string_ostream output_stream ( output ) ;
2016-10-06 04:03:37 +08:00
if ( args . empty ( ) ) {
2017-03-15 17:06:58 +08:00
Log : : ListAllLogChannels ( output_stream ) ;
2016-09-07 04:57:50 +08:00
result . SetStatus ( eReturnStatusSuccessFinishResult ) ;
} else {
2017-02-17 21:27:42 +08:00
bool success = true ;
for ( const auto & entry : args . entries ( ) )
2017-03-15 17:06:58 +08:00
success =
success & & Log : : ListChannelCategories ( entry . ref , output_stream ) ;
2017-02-17 21:27:42 +08:00
if ( success )
result . SetStatus ( eReturnStatusSuccessFinishResult ) ;
2010-06-09 00:52:24 +08:00
}
2017-03-15 17:06:58 +08:00
result . GetOutputStream ( ) < < output_stream . str ( ) ;
2016-09-07 04:57:50 +08:00
return result . Succeeded ( ) ;
}
2010-06-09 00:52:24 +08:00
} ;
2016-09-07 04:57:50 +08:00
class CommandObjectLogTimer : public CommandObjectParsed {
2010-06-09 00:52:24 +08:00
public :
2016-09-07 04:57:50 +08:00
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogTimer ( CommandInterpreter & interpreter )
: CommandObjectParsed ( interpreter , " log timers " ,
" Enable, disable, dump, and reset LLDB internal "
" performance timers. " ,
" log timers < enable <depth> | disable | dump | "
" increment <bool> | reset > " ) { }
~ CommandObjectLogTimer ( ) override = default ;
2010-06-09 00:52:24 +08:00
2012-06-09 05:56:10 +08:00
protected :
2016-09-07 04:57:50 +08:00
bool DoExecute ( Args & args , CommandReturnObject & result ) override {
result . SetStatus ( eReturnStatusFailed ) ;
2016-10-06 04:03:37 +08:00
if ( args . GetArgumentCount ( ) = = 1 ) {
2016-12-09 09:08:29 +08:00
auto sub_command = args [ 0 ] . ref ;
2016-09-07 04:57:50 +08:00
2016-10-06 04:03:37 +08:00
if ( sub_command . equals_lower ( " enable " ) ) {
2016-09-07 04:57:50 +08:00
Timer : : SetDisplayDepth ( UINT32_MAX ) ;
result . SetStatus ( eReturnStatusSuccessFinishNoResult ) ;
2016-10-06 04:03:37 +08:00
} else if ( sub_command . equals_lower ( " disable " ) ) {
2016-09-07 04:57:50 +08:00
Timer : : DumpCategoryTimes ( & result . GetOutputStream ( ) ) ;
Timer : : SetDisplayDepth ( 0 ) ;
result . SetStatus ( eReturnStatusSuccessFinishResult ) ;
2016-10-06 04:03:37 +08:00
} else if ( sub_command . equals_lower ( " dump " ) ) {
2016-09-07 04:57:50 +08:00
Timer : : DumpCategoryTimes ( & result . GetOutputStream ( ) ) ;
result . SetStatus ( eReturnStatusSuccessFinishResult ) ;
2016-10-06 04:03:37 +08:00
} else if ( sub_command . equals_lower ( " reset " ) ) {
2016-09-07 04:57:50 +08:00
Timer : : ResetCategoryTimes ( ) ;
result . SetStatus ( eReturnStatusSuccessFinishResult ) ;
}
2016-10-06 04:03:37 +08:00
} else if ( args . GetArgumentCount ( ) = = 2 ) {
2016-12-09 09:08:29 +08:00
auto sub_command = args [ 0 ] . ref ;
auto param = args [ 1 ] . ref ;
2016-09-07 04:57:50 +08:00
2016-10-06 04:03:37 +08:00
if ( sub_command . equals_lower ( " enable " ) ) {
uint32_t depth ;
if ( param . consumeInteger ( 0 , depth ) ) {
2016-09-07 04:57:50 +08:00
result . AppendError (
" Could not convert enable depth to an unsigned integer. " ) ;
2016-10-06 04:03:37 +08:00
} else {
Timer : : SetDisplayDepth ( depth ) ;
result . SetStatus ( eReturnStatusSuccessFinishNoResult ) ;
}
} else if ( sub_command . equals_lower ( " increment " ) ) {
2016-09-07 04:57:50 +08:00
bool success ;
2016-10-06 04:03:37 +08:00
bool increment = Args : : StringToBoolean ( param , false , & success ) ;
2016-09-07 04:57:50 +08:00
if ( success ) {
Timer : : SetQuiet ( ! increment ) ;
result . SetStatus ( eReturnStatusSuccessFinishNoResult ) ;
} else
result . AppendError ( " Could not convert increment value to boolean. " ) ;
}
}
2010-06-09 00:52:24 +08:00
2016-09-07 04:57:50 +08:00
if ( ! result . Succeeded ( ) ) {
result . AppendError ( " Missing subcommand " ) ;
result . AppendErrorWithFormat ( " Usage: %s \n " , m_cmd_syntax . c_str ( ) ) ;
2010-06-09 00:52:24 +08:00
}
2016-09-07 04:57:50 +08:00
return result . Succeeded ( ) ;
}
2010-06-09 00:52:24 +08:00
} ;
2016-07-15 06:03:10 +08:00
CommandObjectLog : : CommandObjectLog ( CommandInterpreter & interpreter )
2016-09-07 04:57:50 +08:00
: CommandObjectMultiword ( interpreter , " log " ,
" Commands controlling LLDB internal logging. " ,
" log <subcommand> [<command-options>] " ) {
LoadSubCommand ( " enable " ,
CommandObjectSP ( new CommandObjectLogEnable ( interpreter ) ) ) ;
LoadSubCommand ( " disable " ,
CommandObjectSP ( new CommandObjectLogDisable ( interpreter ) ) ) ;
LoadSubCommand ( " list " ,
CommandObjectSP ( new CommandObjectLogList ( interpreter ) ) ) ;
LoadSubCommand ( " timers " ,
CommandObjectSP ( new CommandObjectLogTimer ( interpreter ) ) ) ;
2010-06-09 00:52:24 +08:00
}
2016-02-20 08:58:29 +08:00
CommandObjectLog : : ~ CommandObjectLog ( ) = default ;