aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectFrame.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/CommandObjectFrame.cpp
parent9a587aaaa9e7bed09477c3c8d51d8f44dfd99158 (diff)
downloadllvm-a701509229f658eac7c10bd6aa54cf6ed5b5011d.zip
llvm-a701509229f658eac7c10bd6aa54cf6ed5b5011d.tar.gz
llvm-a701509229f658eac7c10bd6aa54cf6ed5b5011d.tar.bz2
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/CommandObjectFrame.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp59
1 files changed, 29 insertions, 30 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 1593488f..0413664 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -51,11 +51,12 @@ class CommandObjectFrameInfo : public CommandObject
{
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 @@ public:
}
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 @@ class CommandObjectFrameSelect : public CommandObject
{
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 @@ public:
}
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 @@ public:
{
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 @@ public:
// 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 @@ public:
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 @@ CommandObjectFrameVariable::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
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 ()