[lldb-dev] Loading debug symbols (C++, Ubuntu 14.04)

Stefan Kratochwil via lldb-dev lldb-dev at lists.llvm.org
Sat May 7 11:45:01 PDT 2016


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.

I am not using the most recent lldb version - I am currently using svn 
rev 247535, my operating system is a Ubuntu 14.04.

Any help on this is very appreciated!

Thank you very much, and best regards,
Stefan Kratochwil

More information about the lldb-dev mailing list