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

Cary Coutant ccoutant at gmail.com
Fri Dec 7 09:30:27 PST 2018


> > Jakub complains that "the compiler would need to emit a nop after
> > every call, which an optimizing compiler is not willing to do." We're
> > not talking about *every* call, just the rare case of a no-return
> > call.
>
> They aren't that rare, and even if they would, that is still not enough.
> For proper debug info one needs to differentiate between the context inside
> of the call and the context right after the call, while in the %eax case
> that has been discussed it makes no difference, in others it does.
>
> Consider:
> void bar (void);
> void baz (int);
> int
> foo (void)
> {
>   int a = 6;
>   bar ();
>   {
>     long a = 5;
>     baz (10);
>   }
>   return 10;
> }
> If you don't subtract one during unwinding and during the bar call look at
> foo's frame, then it would appear as if you are already at the baz call with
> the inner a variable in scope, but that shouldn't be in scope yet, and if
> user asks for value of a, he should see that 6 and its type should be int,
> not long.

Yes, you're right -- that's a good point. That suggests that perhaps
we should do something more explicit to distinguish between "during a
call" and "after a call". What happens on architectures where the call
instruction is just one addressable unit long? For example, a
word-addressed architecture, or Itanium where some toolchains encode
the slot number as (0, 1, 2) in the low-order bits of the PC?

-cary


More information about the Dwarf-Discuss mailing list