[lldb-dev] Registration from a shared library plugin

Greg Clayton gclayton at apple.com
Tue Nov 12 10:13:26 PST 2013


On Nov 12, 2013, at 4:42 AM, Abid, Hafiz <Hafiz_Abid at mentor.com> wrote:

> Hi All,
> The 'plugin load' command provides a facility to load an LLDB plugin from a shared library. I am wondering if C++ API provides a way to register the plugin with the debugger. Code inside LLDB proper can directly call the static PluginManager::RegisterPlugin() method. Is something equivalent available through the API?
> 
> My question really is what can be done in a plugin that you load from a shared library. An example in the codebase shows that you can add a new command. Is it the only possible usage? Say I want to provide a customized disassembler through a shared library plugin, is this a supported use case? 

No not yet. We have too many internal APIs that are used in the internal plug-ins that we don't want to expose and we haven't gotten around to exposing external plug-ins other than the commands as you noted.

If you plan to make a patch, please be sure to read our API restrictions:

http://lldb.llvm.org/architecture.html#api

There are a few ways to could expose external plug-ins. One method would be to have each type of external plugin register a many C callbacks that would take care of creation, and all methods and each C callback would take a "void *this" parameter as the first argument. Internally we would create a new internal plug-in type that uses these callbacks to implement all of the functions. I haven't really thought to much about any other approaches.

Comments and suggestions?

Greg






More information about the lldb-dev mailing list