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").
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114252 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index 61ada69..1e2d023 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -95,12 +95,12 @@
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 @@
bool
CommandObjectExpression::Execute
(
- CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result
)
@@ -259,12 +258,11 @@
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 @@
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 @@
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 @@
if (end_options)
{
Args args (command, end_options - command);
- if (!ParseOptions (interpreter, args, result))
+ if (!ParseOptions (args, result))
return false;
}
}