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/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 1593488..0413664 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -51,11 +51,12 @@
{
public:
- CommandObjectFrameInfo () :
- CommandObject ("frame info",
- "List information about the currently selected frame in the current thread.",
- "frame info",
- eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+ CommandObjectFrameInfo (CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "frame info",
+ "List information about the currently selected frame in the current thread.",
+ "frame info",
+ eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
}
@@ -64,11 +65,10 @@
}
bool
- Execute (CommandInterpreter &interpreter,
- Args& command,
+ Execute (Args& command,
CommandReturnObject &result)
{
- ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+ ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.frame)
{
exe_ctx.frame->Dump (&result.GetOutputStream(), true, false);
@@ -94,12 +94,12 @@
{
public:
- CommandObjectFrameSelect () :
- CommandObject ("frame select",
- //"Select the current frame by index in the current thread.",
- "Select a frame by index from within the current thread and make it the current frame.",
- "frame select <frame-index>",
- eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+ CommandObjectFrameSelect (CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "frame select",
+ "Select a frame by index from within the current thread and make it the current frame.",
+ "frame select <frame-index>",
+ eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
}
@@ -108,11 +108,10 @@
}
bool
- Execute (CommandInterpreter &interpreter,
- Args& command,
+ Execute (Args& command,
CommandReturnObject &result)
{
- ExecutionContext exe_ctx (interpreter.GetDebugger().GetExecutionContext());
+ ExecutionContext exe_ctx (m_interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.thread)
{
if (command.GetArgumentCount() == 1)
@@ -130,14 +129,14 @@
{
bool already_shown = false;
SymbolContext frame_sc(exe_ctx.frame->GetSymbolContext(eSymbolContextLineEntry));
- if (interpreter.GetDebugger().UseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
+ if (m_interpreter.GetDebugger().UseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
{
already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
}
if (DisplayFrameForExecutionContext (exe_ctx.thread,
exe_ctx.frame,
- interpreter,
+ m_interpreter,
result.GetOutputStream(),
true,
!already_shown,
@@ -288,11 +287,11 @@
// Instance variables to hold the values for command options.
};
- CommandObjectFrameVariable () :
- CommandObject (
- "frame variable",
- "Show specified argument, local variable, static variable or global variable for the current frame. If none specified, list them all.",
- "frame variable [<cmd-options>] [<var-name1> [<var-name2>...]]")
+ CommandObjectFrameVariable (CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "frame variable",
+ "Show specified argument, local variable, static variable or global variable for the current frame. If none specified, list them all.",
+ "frame variable [<cmd-options>] [<var-name1> [<var-name2>...]]")
{
}
@@ -431,12 +430,11 @@
virtual bool
Execute
(
- CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result
)
{
- ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+ ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.frame == NULL)
{
result.AppendError ("invalid frame");
@@ -789,13 +787,14 @@
//-------------------------------------------------------------------------
CommandObjectMultiwordFrame::CommandObjectMultiwordFrame (CommandInterpreter &interpreter) :
- CommandObjectMultiword ("frame",
+ CommandObjectMultiword (interpreter,
+ "frame",
"A set of commands for operating on the current thread's frames.",
"frame <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (interpreter, "info", CommandObjectSP (new CommandObjectFrameInfo ()));
- LoadSubCommand (interpreter, "select", CommandObjectSP (new CommandObjectFrameSelect ()));
- LoadSubCommand (interpreter, "variable", CommandObjectSP (new CommandObjectFrameVariable ()));
+ LoadSubCommand ("info", CommandObjectSP (new CommandObjectFrameInfo (interpreter)));
+ LoadSubCommand ("select", CommandObjectSP (new CommandObjectFrameSelect (interpreter)));
+ LoadSubCommand ("variable", CommandObjectSP (new CommandObjectFrameVariable (interpreter)));
}
CommandObjectMultiwordFrame::~CommandObjectMultiwordFrame ()