Bulk of the infrastructure work to allow script commands to be backed by object insta...
authorEnrico Granata <egranata@apple.com>
Fri, 13 Mar 2015 02:20:41 +0000 (02:20 +0000)
committerEnrico Granata <egranata@apple.com>
Fri, 13 Mar 2015 02:20:41 +0000 (02:20 +0000)
commit9fe00e52d3dc12e80428648d84542f800c362163
tree397f77d6aa9a2d566e2f8d6f4ce8a47d858ecece
parent9f611e3a89c3a87d2748061d149c30e3b132f3a8
Bulk of the infrastructure work to allow script commands to be backed by object instances in addition to free functions
This works by creating a command backed by a class whose interface should - at least - include

def __init__(self, debugger, session_dict)
def __call__(self, args, return_obj, exe_ctx)

What works:
- adding a command via command script add --class
- calling a thusly created command

What is missing:
- support for custom help
- test cases

The missing parts will follow over the next couple of days

This is an improvement over the existing system as:
a) it provides an obvious location for commands to provide help strings (i.e. methods)
b) it allows commands to store state in an obvious fashion
c) it allows us to easily add features to script commands over time (option parsing and subcommands registration, I am looking at you :-)

llvm-svn: 232136
lldb/include/lldb/Interpreter/ScriptInterpreter.h
lldb/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/scripts/Python/python-wrapper.swig
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp
lldb/source/Interpreter/ScriptInterpreterPython.cpp