summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectPythonFunction.h
diff options
context:
space:
mode:
authorEnrico Granata <granata.enrico@gmail.com>2011-08-16 16:49:25 +0000
committerEnrico Granata <granata.enrico@gmail.com>2011-08-16 16:49:25 +0000
commitbe93a35a8a29376abab778bbe96d3060e79d4f8e (patch)
treea2a1b5ebe5a8a3df82878448441d0a64403e3efb /lldb/source/Commands/CommandObjectPythonFunction.h
parent5de2044f3d417831d2e64e7df089edce394ed14e (diff)
downloadbcm5719-llvm-be93a35a8a29376abab778bbe96d3060e79d4f8e.tar.gz
bcm5719-llvm-be93a35a8a29376abab778bbe96d3060e79d4f8e.zip
Python commands:
It is now possible to use 'command alias --python' to define a command name that actually triggers execution of a Python function (e.g. command alias --python foo foo_impl makes a command named 'foo' that runs Python function 'foo_impl') The Python function foo_impl should have as signature: def foo_impl(debugger, args, stream, dict): where debugger is an object wrapping an LLDB SBDebugger args is the command line arguments, as an unparsed Python string stream is an SBStream that represents the standard output dict is an internal utility parameter and should be left untouched The function should return None on no error, or an error string to describe any problems llvm-svn: 137722
Diffstat (limited to 'lldb/source/Commands/CommandObjectPythonFunction.h')
-rw-r--r--lldb/source/Commands/CommandObjectPythonFunction.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectPythonFunction.h b/lldb/source/Commands/CommandObjectPythonFunction.h
new file mode 100644
index 00000000000..4af857dccd5
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectPythonFunction.h
@@ -0,0 +1,62 @@
+//===-- CommandObjectPythonFunction.h -----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandObjectPythonFunction_h_
+#define liblldb_CommandObjectPythonFunction_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Interpreter/CommandObject.h"
+
+namespace lldb_private {
+
+//-------------------------------------------------------------------------
+// CommandObjectApropos
+//-------------------------------------------------------------------------
+
+class CommandObjectPythonFunction : public CommandObject
+{
+private:
+ std::string m_function_name;
+
+public:
+
+ CommandObjectPythonFunction (CommandInterpreter &interpreter,
+ std::string name,
+ std::string funct);
+
+ virtual
+ ~CommandObjectPythonFunction ();
+
+ virtual bool
+ ExecuteRawCommandString (const char *raw_command_line, CommandReturnObject &result);
+
+ virtual bool
+ WantsRawCommandString ()
+ {
+ return true;
+ }
+
+ bool
+ Execute (Args& command,
+ CommandReturnObject &result)
+ {
+ std::string cmd_string;
+ command.GetCommandString(cmd_string);
+ return ExecuteRawCommandString(cmd_string.c_str(), result);
+ }
+
+
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandObjectPythonFunction_h_
OpenPOWER on IntegriCloud