line info

Mark Wielaard
Thu Sep 12 09:04:00 GMT 2019

Hi Sasha,

On Wed, Sep 11, 2019 at 09:52:23PM +0000, Sasha Da Rocha Pinheiro wrote:
> how do we get the line info range end address for a given line and file?

I am not sure I understand your question competely.  What are you
using to get at the line and file?  In theory there is no "range end
address" for a given source file line.  The instructions associated
with a particular source code line can be scattered around by various
compiler optimisations.

> For instance, gdb adds 2 breapoint to:
> (gdb) b /g/g90/devkota1/LULESH/
> Breakpoint 1 at 0x4060a0: /g/g90/devkota1/LULESH/ (2 locations)
> (gdb) i b
> Num     Type           Disp Enb Address            What
> 1       breakpoint     keep y   <MULTIPLE>         
> 1.1                         y     0x00000000004060a0 in CollectDomainNodesToElemNodes(Domain&, Index_t const*, Real_t*, Real_t*, Real_t*) at
> 1.2                         y     0x0000000000409c0c in CalcKinematicsForElems(Domain&, double, int) 
>                                                    at
> And we find all these locations:
> Compilation Unit name:
> [403eb0, ffffffffffffffff) /g/g90/devkota1/LULESH/
> [405477, ffffffffffffffff) /g/g90/devkota1/LULESH/lulesh.h:233 
> [4060a0, ffffffffffffffff) /g/g90/devkota1/LULESH/ 
> [409c0c, ffffffffffffffff) /g/g90/devkota1/LULESH/ 
> But we need to get the whole range, lower and upper addresses.

Is this in gdb? Or do you mean using one of the elfutils tools or

To see how addresses map to source code lines using eu-readelf, try
eu-readelf --debug-dump=line and --debug-dump=decodedline

When using the libdw interface you are probably looking for
dwarf_next_lines () and dwarf_linesrc (), you can then use the
different dwarf_line* () functions to get at the attributes.



More information about the Elfutils-devel mailing list