line info

Mark Wielaard
Wed Oct 2 16:14:00 GMT 2019

Hi Sasha,

Sorry for the late reply.

On Thu, 2019-09-12 at 15:22 +0000, Sasha Da Rocha Pinheiro wrote:
> For my knowledge about it, this information is not encoded in the
> dwarf_line state machine instructions. Right? Would you know how to
> get it?
> I know that the state machine will shift line number and address
> number to encode instructions such as:
> DW_LNS_fixed_advance_pc
> SPECIAL(2, 0)
> DW_LNS_fixed_advance_pc
> SPECIAL(2, 0)
> DW_LNS_fixed_advance_pc
> SPECIAL(1, 0)
> DW_LNS_fixed_advance_pc
> SPECIAL(1, 0)
> DW_LNS_fixed_advance_pc
> DW_LNE_end_sequence
> And that does not give us range end. Am I correct? Can we make any
> assumptions for it?

The line number table gives a mapping from addresses to source line.
You could get the reverse information out of it, but since the table is
ordered by addresses it isn't very convenient to construct a source
line to addresses mapping. Also there is no guarantee that any source
line will map to a continuous range of addresses, so there might not be
one starting address and one ending address.

I don't know what you really need this for, but you could get some
information about function or some syntactical scopes from the DIE
tree. Which you can get with dwarf_ranges (). Which might or might not
be what you are looking for?



More information about the Elfutils-devel mailing list