aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectProcess.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-10-13 02:07:45 +0000
committerGreg Clayton <gclayton@apple.com>2012-10-13 02:07:45 +0000
commit998255bfe841a4191d458a56aae0267f673b1a72 (patch)
treeada5b24a203f1a24e041f9cce2188283d037de98 /lldb/source/Commands/CommandObjectProcess.cpp
parent88db3171dd5dcc54e3890b6f823c60831fc520a5 (diff)
downloadllvm-998255bfe841a4191d458a56aae0267f673b1a72.zip
llvm-998255bfe841a4191d458a56aae0267f673b1a72.tar.gz
llvm-998255bfe841a4191d458a56aae0267f673b1a72.tar.bz2
<rdar://problem/12491387>
I added the ability for a process plug-in to implement custom commands. All the lldb_private::Process plug-in has to do is override: virtual CommandObject * GetPluginCommandObject(); This object returned should be a multi-word command that vends LLDB commands. There is a sample implementation in ProcessGDBRemote that is hollowed out. It is intended to be used for sending a custom packet, though the body of the command execute function has yet to be implemented! llvm-svn: 165861
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 5653e7a..41e216e 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -1071,7 +1071,6 @@ protected:
CommandOptions m_options;
};
-
OptionDefinition
CommandObjectProcessConnect::CommandOptions::g_option_table[] =
{
@@ -1080,6 +1079,39 @@ CommandObjectProcessConnect::CommandOptions::g_option_table[] =
};
//-------------------------------------------------------------------------
+// CommandObjectProcessPlugin
+//-------------------------------------------------------------------------
+#pragma mark CommandObjectProcessPlugin
+
+class CommandObjectProcessPlugin : public CommandObjectProxy
+{
+public:
+
+ CommandObjectProcessPlugin (CommandInterpreter &interpreter) :
+ CommandObjectProxy (interpreter,
+ "process plugin",
+ "Send a custom command to the current process plug-in.",
+ "process plugin <args>",
+ 0)
+ {
+ }
+
+ ~CommandObjectProcessPlugin ()
+ {
+ }
+
+ virtual CommandObject *
+ GetProxyCommandObject()
+ {
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+ if (process)
+ return process->GetPluginCommandObject();
+ return NULL;
+ }
+};
+
+
+//-------------------------------------------------------------------------
// CommandObjectProcessLoad
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessLoad
@@ -1794,6 +1826,7 @@ CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter
LoadSubCommand ("status", CommandObjectSP (new CommandObjectProcessStatus (interpreter)));
LoadSubCommand ("interrupt", CommandObjectSP (new CommandObjectProcessInterrupt (interpreter)));
LoadSubCommand ("kill", CommandObjectSP (new CommandObjectProcessKill (interpreter)));
+ LoadSubCommand ("plugin", CommandObjectSP (new CommandObjectProcessPlugin (interpreter)));
}
CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess ()