Implementing plugins that provide commands.
authorEnrico Granata <egranata@apple.com>
Fri, 28 Sep 2012 23:57:51 +0000 (23:57 +0000)
committerEnrico Granata <egranata@apple.com>
Fri, 28 Sep 2012 23:57:51 +0000 (23:57 +0000)
commit21dfcd9d41a1a325cd373bb0fcc0172400e94f44
treee3d6b18d99bbc2ef2f718d52972fff54fc6232a5
parentb555a767baf4a1058bc6e4e05acbbee9e55d0e26
Implementing plugins that provide commands.
This checkin adds the capability for LLDB to load plugins from external dylibs that can provide new commands
It exports an SBCommand class from the public API layer, and a new SBCommandPluginInterface

There is a minimal load-only plugin manager built into the debugger, which can be accessed via Debugger::LoadPlugin.

Plugins are loaded from two locations at debugger startup (LLDB.framework/Resources/PlugIns and ~/Library/Application Support/LLDB/PlugIns) and more can be (re)loaded via the "plugin load" command

For an example of how to make a plugin, refer to the fooplugin.cpp file in examples/plugins/commands

Caveats:
Currently, the new API objects and features are not exposed via Python.
The new commands can only be "parsed" (i.e. not raw) and get their command line via a char** parameter (we do not expose our internal Args object)
There is no unloading feature, which can potentially lead to leaks if you overwrite the commands by reloading the same or different plugins
There is no API exposed for option parsing, which means you may need to use getopt or roll-your-own

llvm-svn: 164865
22 files changed:
lldb/examples/plugins/commands/fooplugin.cpp [new file with mode: 0644]
lldb/include/lldb/API/SBCommandInterpreter.h
lldb/include/lldb/API/SBCommandReturnObject.h
lldb/include/lldb/API/SBDebugger.h
lldb/include/lldb/API/SBDefines.h
lldb/include/lldb/API/SBError.h
lldb/include/lldb/Core/Debugger.h
lldb/include/lldb/Host/DynamicLibrary.h [new file with mode: 0644]
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Interpreter/CommandObjectMultiword.h
lldb/include/lldb/lldb-forward.h
lldb/lldb.xcodeproj/project.pbxproj
lldb/scripts/Python/build-swig-Python.sh
lldb/scripts/Python/interface/SBCommandInterpreter.i
lldb/scripts/Python/interface/SBCommandReturnObject.i
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/API/SBCommandReturnObject.cpp
lldb/source/Commands/CommandObjectPlugin.cpp [new file with mode: 0644]
lldb/source/Commands/CommandObjectPlugin.h [new file with mode: 0644]
lldb/source/Core/Debugger.cpp
lldb/source/Host/common/DynamicLibrary.cpp [new file with mode: 0644]
lldb/source/Interpreter/CommandInterpreter.cpp