[lldb-dev] Building a command plugin for lldb

Greg Clayton clayborg at gmail.com
Fri Feb 20 15:52:50 PST 2015


> On Feb 18, 2015, at 12:06 PM, Mike McLaughlin <mikem at microsoft.com> wrote:
> 
> I have a couple of questions about lldb:
> 
> 1) I building a lldb command plugin for dotnet/coreclr (sos for lldb) and it currently depends on the lldb source (API h files) and the lldb build. Is there a package that includes just the public h and library files necessary to build a lldb plugin?  I’ve heard there is one for llvm.  Or am I stuck enlisting and building lldb to build my plugin?

Why don't you do this in Python?

http://lldb.llvm.org/python-reference.html

See section titled "CREATE A NEW LLDB COMMAND USING A PYTHON FUNCTION"

This keeps you isolated from having to link against anything at all.

> 
> 2) Is there any way to get the plugin’s load path?  I want to load another module dynamically in the same directory as my lldb plugin.  I’m still learning about linux and lldb but it doesn’t look like there is a lldb api or the equivalent of Windows the hmodule passed to the DllMain.


int some_function_in_your_plugin()
{
}

Then you can ask the host to locate the module for a specific function:

 FileSpec plugin_file_spec = Host::GetModuleFileSpecForHostAddress(reinterpret_cast<void *>(reinterpret_cast<intptr_t>(some_function_in_your_plugin))));





More information about the lldb-dev mailing list