diff options
Diffstat (limited to 'lldb/examples/python/cmdtemplate.py')
-rw-r--r-- | lldb/examples/python/cmdtemplate.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lldb/examples/python/cmdtemplate.py b/lldb/examples/python/cmdtemplate.py index 12192e9b916..b7ad0a373de 100644 --- a/lldb/examples/python/cmdtemplate.py +++ b/lldb/examples/python/cmdtemplate.py @@ -33,17 +33,18 @@ def ls(debugger, command, result, dict): for arg in args: if options.verbose: - print commands.getoutput('/bin/ls "%s"' % arg) + result.PutCString(commands.getoutput('/bin/ls "%s"' % arg)) else: - print commands.getoutput('/bin/ls -lAF "%s"' % arg) + result.PutCString(commands.getoutput('/bin/ls -lAF "%s"' % arg)) if __name__ == '__main__': # This script is being run from the command line, create a debugger in case we are # going to use any debugger functions in our function. lldb.debugger = lldb.SBDebugger.Create() ls (sys.argv) -elif lldb.debugger: - # This script is being run from LLDB in the emabedded command interpreter + +def __lldb_init_module (debugger, dict): + # This initializer is being run from LLDB in the embedded command interpreter # Add any commands contained in this module to LLDB - lldb.debugger.HandleCommand('command script add -f cmdtemplate.ls ls') + debugger.HandleCommand('command script add -f cmdtemplate.ls ls') print '"ls" command installed, type "ls --help" for detailed help' |