summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectExpression.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/CommandObjectExpression.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/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 61ada69e48f..1e2d0235598 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -95,12 +95,12 @@ CommandObjectExpression::CommandOptions::GetDefinitions ()
return g_option_table;
}
-CommandObjectExpression::CommandObjectExpression () :
- CommandObject (
- "expression",
- "Evaluate an Objective-C++ expression in the current program context, using variables currently in scope.",
- "expression [<cmd-options>] <expr>"),
- m_expr_line_count (0),
+CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "expression",
+ "Evaluate an Objective-C++ expression in the current program context, using variables currently in scope.",
+ "expression [<cmd-options>] <expr>"),
+m_expr_line_count (0),
m_expr_lines ()
{
SetHelpLong(
@@ -125,7 +125,6 @@ CommandObjectExpression::GetOptions ()
bool
CommandObjectExpression::Execute
(
- CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result
)
@@ -259,12 +258,11 @@ CommandObjectExpression::EvaluateExpression (const char *expr, bool bare, Stream
bool
CommandObjectExpression::ExecuteRawCommandString
(
- CommandInterpreter &interpreter,
const char *command,
CommandReturnObject &result
)
{
- m_exe_ctx = interpreter.GetDebugger().GetExecutionContext();
+ m_exe_ctx = m_interpreter.GetDebugger().GetExecutionContext();
m_options.ResetOptionValues();
@@ -275,7 +273,7 @@ CommandObjectExpression::ExecuteRawCommandString
m_expr_lines.clear();
m_expr_line_count = 0;
- InputReaderSP reader_sp (new InputReader(interpreter.GetDebugger()));
+ InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
if (reader_sp)
{
Error err (reader_sp->Initialize (CommandObjectExpression::MultiLineExpressionCallback,
@@ -286,7 +284,7 @@ CommandObjectExpression::ExecuteRawCommandString
true)); // echo input
if (err.Success())
{
- interpreter.GetDebugger().PushInputReader (reader_sp);
+ m_interpreter.GetDebugger().PushInputReader (reader_sp);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
@@ -328,7 +326,7 @@ CommandObjectExpression::ExecuteRawCommandString
if (end_options)
{
Args args (command, end_options - command);
- if (!ParseOptions (interpreter, args, result))
+ if (!ParseOptions (args, result))
return false;
}
}
OpenPOWER on IntegriCloud