[Dwarf-Discuss] Location list entries for caller-saved registers at time of call

Jakub Jelinek jakub at redhat.com
Fri Dec 7 08:37:41 PST 2018

On Fri, Dec 07, 2018 at 08:28:06AM -0800, Michael Eager wrote:
> > and in .debug_loc etc., I can provide say one location description for the
> > range .L0 to .L1 (i.e. for instructions before the call
> > instruction, another one e.g. for .L1 to .L2-1, valid on the call
> > instruction, but not inside of the foo call, another one from .L2-1 to .L2,
> > valid after the call foo instruction is done but before the call returned
> > (i.e. inside of the foo call or whatever it calls) and finally .L2 to .L3
> > range which covers the instructions after the call.
> The reason that the loclist is [start, end) is so that you do not need
> to pretend that there is a valid .L2-1 PC value.  There is no valid PC
> range of [.L1, .L2-1) or [.L2-1, .L2).  When inside the called
> procedure, the return address is .L2, NOT .L2-1.

I don't see a restriction in the DWARF standard that would say that all
ranges must be boundaries of instructions.  And, if I limit to just that,
I can only have ranges .L0-.L1, instructions before the call but not on the
call instruction itself, .L1-.L2, the call instruction and .L2-.L3 which
would be inside of the call + at the start of the instruction after it.
And those two need to be differentiated, otherwise the compiler would need
to emit a nop after every call, which an optimizing compiler is not willing
to do.  As I said, all the consumers that aren't horribly broken subtract
one, because there is no guarantee of the nop instructions after the calls.


More information about the Dwarf-Discuss mailing list