[lldb-dev] Accessing DWARF information from C++

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Tue Oct 13 11:05:53 PDT 2015


> On Oct 13, 2015, at 9:03 AM, Stefan Kratochwil via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
> well, I found the llvm-dwarfdump tool in the tools directory *facepalm*...
> I'll use that as a reference.
> 
> That leaves the question about the two separate DWARF implementations.

Ideally it would be good to try to merge the two implementations.  However, lldb's usage patterns - doing focused queries, only unpacking as little of the DWARF as it can possibly manage to satisfy such queries, etc, are very different from those of a straight up dumper.  N.B. if you're not very careful how you handle debug information in the debugger you can get really dramatic performance problems particularly with large projects.  Since this is so crucial, we (mostly Greg) built lldb's DWARF reader as an experiment in supporting those patterns as efficiently as possible, rather than as a general purpose library.  So replacing the current implementation is not a task to be undertaken lightly.  To date, there hasn't been a compelling reason to do that work as opposed to all the other interesting stuff we could be doing.

Jim

> 
> Cheers,
> Stefan
> 
> On 10/13/2015 11:42 AM, Stefan Kratochwil via lldb-dev wrote:
>> Hi altogether,
>> 
>> I currently am developing an application where I need to access the
>> DWARF debugging information of my target process and its loaded .so files.
>> 
>> In more detail, I need to match type information of certain entities
>> within my code and its dynamically linked libraries.
>> 
>> 
>> I already use the lldb scripting bridge in my application, hence I would
>> like to use lldb's DWARF parsing capabilities in my application, too.
>> 
>> Now, there is no (obvious) way to extract DIEs using the C++ API, so I
>> need a few hints where to start. Does anyone have a minimal example for
>> simply dumping DWARF info in a 'readelf -w' manner?
>> 
>> 
>> I further  discovered another DWARF implementation within the llvm
>> sources. After some investigation I found this discussion on lldb-dev:
>> http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-June/004197.html
>> 
>> Does anybody know if there is already some effort made to implement a
>> lldwarf solution as a replacement for both mentioned implementations?
>> 
>> And, after going through the discussion, is it probably better for me to
>> use the llvm fork?
>> 
>> Thanks in advance!
>> 
>> 
>> Cheers,
>> Stefan
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list