[lldb-dev] Loading debug symbols (C++, Ubuntu 14.04)
Pavel Labath via lldb-dev
lldb-dev at lists.llvm.org
Mon May 9 01:22:14 PDT 2016
Hi Stefan,
what you are describing should work out of the box, so the fact that
you are having to add the symbols manually is a bug. I haven't tried
it with the apache binary specifically, but lldb can certainly find
external debug symbols for libc (definitely on ubuntu 14.04, as that's
what I use). We need to figure out what is different in your case. The
most important function here is SymbolVendorELF::CreateInstance. Could
you step through that function, and see why it fails to find the file?
On 7 May 2016 at 19:45, Stefan Kratochwil via lldb-dev
<lldb-dev at lists.llvm.org> wrote:
> Hi,
>
> I need to gather information about variables on the stack frames of a given
> program, lets say apache2 (httpd), using the C++ flavour of the lldb
> scripting bridge.
>
> Now, if I attach to the corresponding process id, lldb does not find any
> debug symbols, although I have installed the debug symbols package for
> apache2 (apache2-dbg).
>
> If I use the lldb cli, I have to use
> 'target symbols load /usr/lib/debug/usr/sbin/apache2'
> (or any other path under /usr/lib/debug, depending on the stack frame /
> module I am currently looking at) to load the corresponding debug symbols.
>
> However, if I try the same with gdb, then it automagically uses the binaries
> under /usr/lib/debug (the non-stripped binaries from any *-dbg package are
> located here) for symbolification.
>
>
> Now, there are two questions for me:
>
> 1.: Is there a way to let lldb automagically load debug symbols from
> /usr/lib/debug, if there are any?
>
> 2.: If not, how can I do this manually using the C++ API?
> The SBTarget class does not have suitable methods for this - the closest
> thing is SBTarget#AddModule(), but this gives me a _new_ module, instead of
> associating a symbolfile with an existing one. The code path of
> CommandObjectTarget.cpp#AddModuleSymbols() seems not to be reflected in the
> scripting bridge, or at least I haven't found it yet.
You can use SBDebugger::HandleCommand to execute any command which
does have an API equivalent. It's not ideal, but it works. :)
cheers,
pl
More information about the lldb-dev
mailing list