diff options
author | Greg Clayton <gclayton@apple.com> | 2010-09-18 01:14:36 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-09-18 01:14:36 +0000 |
commit | a701509229f658eac7c10bd6aa54cf6ed5b5011d (patch) | |
tree | b38ff5cfb3fd466e5c7f89cea9bd9fa7d89eed16 /lldb/source/Commands/CommandObjectRegister.cpp | |
parent | 9a587aaaa9e7bed09477c3c8d51d8f44dfd99158 (diff) | |
download | bcm5719-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/CommandObjectRegister.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectRegister.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index 7d11a6e93db..6182509ee80 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -31,8 +31,9 @@ using namespace lldb_private; class CommandObjectRegisterRead : public CommandObject { public: - CommandObjectRegisterRead () : - CommandObject ("register read", + CommandObjectRegisterRead (CommandInterpreter &interpreter) : + CommandObject (interpreter, + "register read", "Dump the contents of one or more register values from the current frame.", "register read [<reg-name1> [<reg-name2> [...]]]", eFlagProcessMustBeLaunched | eFlagProcessMustBePaused) @@ -47,14 +48,13 @@ public: virtual bool Execute ( - CommandInterpreter &interpreter, Args& command, CommandReturnObject &result ) { StreamString &output_stream = result.GetOutputStream(); DataExtractor reg_data; - ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext()); + ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext()); RegisterContext *reg_context = exe_ctx.GetRegisterContext (); if (reg_context) @@ -139,8 +139,9 @@ public: class CommandObjectRegisterWrite : public CommandObject { public: - CommandObjectRegisterWrite () : - CommandObject ("register write", + CommandObjectRegisterWrite (CommandInterpreter &interpreter) : + CommandObject (interpreter, + "register write", "Modify a single register value.", "register write <reg-name> <value>", eFlagProcessMustBeLaunched | eFlagProcessMustBePaused) @@ -155,13 +156,12 @@ public: virtual bool Execute ( - CommandInterpreter &interpreter, Args& command, CommandReturnObject &result ) { DataExtractor reg_data; - ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext()); + ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext()); RegisterContext *reg_context = exe_ctx.GetRegisterContext (); if (reg_context) @@ -219,12 +219,13 @@ public: // CommandObjectRegister constructor //---------------------------------------------------------------------- CommandObjectRegister::CommandObjectRegister(CommandInterpreter &interpreter) : - CommandObjectMultiword ("register", + CommandObjectMultiword (interpreter, + "register", "A set of commands to access thread registers.", "register [read|write] ...") { - LoadSubCommand (interpreter, "read", CommandObjectSP (new CommandObjectRegisterRead ())); - LoadSubCommand (interpreter, "write", CommandObjectSP (new CommandObjectRegisterWrite ())); + LoadSubCommand ("read", CommandObjectSP (new CommandObjectRegisterRead (interpreter))); + LoadSubCommand ("write", CommandObjectSP (new CommandObjectRegisterWrite (interpreter))); } |