From: Enrico Granata Date: Fri, 13 Mar 2015 22:27:36 +0000 (+0000) Subject: Introduce documentation for Python command objects X-Git-Tag: llvmorg-3.7.0-rc1~9271 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2fc62ed37db98846f4b4accf34d6f6db648da7fd;p=platform%2Fupstream%2Fllvm.git Introduce documentation for Python command objects llvm-svn: 232225 --- diff --git a/lldb/www/python-reference.html b/lldb/www/python-reference.html index 6e75e11..bb45062 100755 --- a/lldb/www/python-reference.html +++ b/lldb/www/python-reference.html @@ -411,6 +411,24 @@ Enter your Python command(s). Type 'DONE' to end. + +

Starting with SVN revision 232224, Python commands can also be implemented by means of a class + which should implement the following interface:

+ + + class CommandObjectType:
+     def __init__(self, debugger, session_dict):
+         this call should initialize the command with respect to the command interpeter for the passed-in debugger
+     def __call__(self, debugger, command, exe_ctx, result):
+         this is the actual bulk of the command, akin to Python command functions
+     def get_short_help(self):
+         this call should return the short help text for this command[1]
+     def get_long_help(self):
+         this call should return the long help text for this command[1]
+
+ +[1] This method is optional. +

As a convenience, you can treat the result object as a Python file object, and say

print >>result, "my command does lots of cool stuff"
SBCommandReturnObject and SBStream