[lldb-dev] Building a command plugin for lldb
Mike McLaughlin
mikem at microsoft.com
Sat Feb 21 10:27:32 PST 2015
Thanks for your response. My lldb plugin needs to call a bunch C++ code ported from Windows/Windbg so doing this in Python really isn't practical. I found the lldb-3.5-dev package not too long after I sent my email and it contains everything I need to build my plugin without depending on a lldb build directly.
mikem
-----Original Message-----
From: Greg Clayton [mailto:clayborg at gmail.com]
Sent: Friday, February 20, 2015 3:53 PM
To: Mike McLaughlin
Cc: lldb-dev at cs.uiuc.edu
Subject: Re: [lldb-dev] Building a command plugin for lldb
> 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