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

Michael Eager eager@eagerm.com
Fri Dec 7 15:57:23 GMT 2018


On 12/07/2018 04:54 AM, Jakub Jelinek wrote:
> On Fri, Dec 07, 2018 at 12:36:39PM +0000, David Stenberg via Dwarf-Discuss wrote:
> 
> For calls, we need to distinguish the locations that are valid in the caller
> on the call instruction before the call instruction has been executed, then
> locations that are valid while inside of the call and finally locations that
> are valid after the call has returned.

But the call instruction is atomic.  There are not distinct PC locations
within an individual call instruction.

> The 3 can differ, before the call instruction has been executed the
> locations can include registers clobbered by the call, during the call they
> can't, as the call could have clobbered them already.  Call-saved registers
> aren't a problem, there is unwind info in the callee how to restore that and
> the debugger can unwind to the caller.  As GCC generally doesn't track the
> length of the call instruction, it uses that end of call instruction - 1
> as the label somewhere in the middle of the call instruction, so at the
> start of the call instruction can be some locations, during the call other
> set and right after the call another set.

What does this mean?  If GCC doesn't know the length of the call
instruction, how can it generate a label of the end - 1?

There is no valid PC address in the middle of a call instruction (as
noted above).  What does a label in the middle of an instruction mean?

I know what the PC is before the call, I know what the
return address is in the called routine, and I know what the PC is
after the return.  None of these addresses is in the middle of the call.

Why not generate the label as the next address following the call?

-- 
Michael Eager    eager at eagerm.com
1960 Park Blvd., Palo Alto, CA 94306



More information about the Dwarf-discuss mailing list