[llvm-commits] PATCH: DebugInfo library: add methods to fetch function name for a given address
Alexey Samsonov
samsonov at google.com
Thu Jun 28 00:34:16 PDT 2012
Benjamin,
Could you please take a look at this?
On Mon, Jun 25, 2012 at 7:10 PM, Alexey Samsonov <samsonov at google.com>wrote:
> Attaching revised patch (according to dvyukov@'s comments).
>
>
> On Mon, Jun 25, 2012 at 5:58 PM, Alexey Samsonov <samsonov at google.com>wrote:
>
>> Hi!
>>
>> This patch fixes minor issues in libLLVMDebugInfo and adds an interface
>> its clients can use to
>> fetch the function name for a given instruction address (analogue to
>> "addr2line -f").
>>
>> The usage is illustrated by the additional flag to llvm-dwarfdump tool.
>>
>> Currently the implementation is straightforward:
>> 1) get the compile unit for a given address (using pre-built list of
>> address ranges).
>> 2) re-extract all DIEs of this compile unit.
>> 3) iterate over all DIEs and find a subprogram DIE, such that given
>> address lies in PC range of this subprogram.
>>
>> If this patch is ok, I would like to go on further and add functionality
>> to fetch the
>> file/line info and function names for all the inlined frames. Hopefully,
>> this wouldn't require much code (the code which
>> builds a DIE tree for each compile unit is already present). However, the
>> clients of DebugInfo lib would
>> have to pass an additional section to DIContext ctor - .debug_ranges (in
>> fact, it is necessary even for the
>> current code, as compiling with -O2 often breaks PC range of functions
>> into multiple ranges).
>>
>> Codereview: http://codereview.appspot.com/6342043/
>>
>> --
>> Alexey Samsonov, MSK
>>
>>
>
>
> --
> Alexey Samsonov, MSK
>
--
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120628/5e2f3ce1/attachment.html>
More information about the llvm-commits
mailing list