[llvm-commits] PATCH: DebugInfo library: add methods to fetch function name for a given address

Benjamin Kramer benny.kra at googlemail.com
Thu Jun 28 05:22:43 PDT 2012


On 28.06.2012, at 09:34, Alexey Samsonov wrote:

> Benjamin,
> 
> Could you please take a look at this?

Thanks for the heads up, I added my comments to the review tool at http://codereview.appspot.com/6342043/#msg5

- Ben

> 
> 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
> 





More information about the llvm-commits mailing list