summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectLog.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-18 01:14:36 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-18 01:14:36 +0000
commita701509229f658eac7c10bd6aa54cf6ed5b5011d (patch)
treeb38ff5cfb3fd466e5c7f89cea9bd9fa7d89eed16 /lldb/source/Commands/CommandObjectLog.cpp
parent9a587aaaa9e7bed09477c3c8d51d8f44dfd99158 (diff)
downloadbcm5719-llvm-a701509229f658eac7c10bd6aa54cf6ed5b5011d.tar.gz
bcm5719-llvm-a701509229f658eac7c10bd6aa54cf6ed5b5011d.zip
Fixed the way set/show variables were being accessed to being natively
accessed by the objects that own the settings. The previous approach wasn't very usable and made for a lot of unnecessary code just to access variables that were already owned by the objects. While I fixed those things, I saw that CommandObject objects should really have a reference to their command interpreter so they can access the terminal with if they want to output usaage. Fixed up all CommandObjects to take an interpreter and cleaned up the API to not need the interpreter to be passed in. Fixed the disassemble command to output the usage if no options are passed down and arguments are passed (all disassebmle variants take options, there are no "args only"). llvm-svn: 114252
Diffstat (limited to 'lldb/source/Commands/CommandObjectLog.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectLog.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index f5ad33d5df5..d2e0652639a 100644
--- a/lldb/source/Commands/CommandObjectLog.cpp
+++ b/lldb/source/Commands/CommandObjectLog.cpp
@@ -58,8 +58,9 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectLogEnable() :
- CommandObject ("log enable",
+ CommandObjectLogEnable(CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "log enable",
"Enable logging for a single log channel.",
"log enable [<cmd-options>] <channel>")
{
@@ -77,8 +78,7 @@ public:
}
virtual bool
- Execute (CommandInterpreter &interpreter,
- Args& args,
+ Execute (Args& args,
CommandReturnObject &result)
{
if (args.GetArgumentCount() < 1)
@@ -95,7 +95,7 @@ public:
if (m_options.log_file.empty())
{
- log_stream_sp.reset(new StreamFile(interpreter.GetDebugger().GetOutputFileHandle()));
+ log_stream_sp.reset(new StreamFile(m_interpreter.GetDebugger().GetOutputFileHandle()));
}
else
{
@@ -234,10 +234,11 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectLogDisable() :
- CommandObject ("log disable",
- "Disable one or more log channels.",
- "log disable <channel> [<channel> ...]")
+ CommandObjectLogDisable(CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "log disable",
+ "Disable one or more log channels.",
+ "log disable <channel> [<channel> ...]")
{
}
@@ -247,8 +248,7 @@ public:
}
virtual bool
- Execute (CommandInterpreter &interpreter,
- Args& args,
+ Execute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@@ -295,8 +295,9 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectLogList() :
- CommandObject ("log list",
+ CommandObjectLogList(CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "log list",
"List the log categories for one or more log channels.",
"log list <channel> [<channel> ...]")
{
@@ -308,8 +309,7 @@ public:
}
virtual bool
- Execute (CommandInterpreter &interpreter,
- Args& args,
+ Execute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@@ -358,8 +358,9 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectLogTimer() :
- CommandObject ("log timers",
+ CommandObjectLogTimer(CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "log timers",
"Enable, disable, dump, and reset LLDB internal performance timers.",
"log timers < enable | disable | dump | reset >")
{
@@ -371,8 +372,7 @@ public:
}
virtual bool
- Execute (CommandInterpreter &interpreter,
- Args& args,
+ Execute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@@ -418,14 +418,15 @@ public:
// CommandObjectLog constructor
//----------------------------------------------------------------------
CommandObjectLog::CommandObjectLog(CommandInterpreter &interpreter) :
- CommandObjectMultiword ("log",
+ CommandObjectMultiword (interpreter,
+ "log",
"A set of commands for operating on logs.",
"log <command> [<command-options>]")
{
- LoadSubCommand (interpreter, "enable", CommandObjectSP (new CommandObjectLogEnable));
- LoadSubCommand (interpreter, "disable", CommandObjectSP (new CommandObjectLogDisable));
- LoadSubCommand (interpreter, "list", CommandObjectSP (new CommandObjectLogList));
- LoadSubCommand (interpreter, "timers", CommandObjectSP (new CommandObjectLogTimer));
+ LoadSubCommand ("enable", CommandObjectSP (new CommandObjectLogEnable (interpreter)));
+ LoadSubCommand ("disable", CommandObjectSP (new CommandObjectLogDisable (interpreter)));
+ LoadSubCommand ("list", CommandObjectSP (new CommandObjectLogList (interpreter)));
+ LoadSubCommand ("timers", CommandObjectSP (new CommandObjectLogTimer (interpreter)));
}
//----------------------------------------------------------------------
OpenPOWER on IntegriCloud