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

Cary Coutant ccoutant at gmail.com
Fri Dec 7 09:58:22 PST 2018

> > This example shows local in %eax, which is a caller-save (i.e.,
> > scratch) register. GCC is right to show that the value is unknown upon
> > return from the call, because set() can clobber that register.
> Sorry, typo -- %eax is a *callee-save* register.

Argh! No, I was right the first time. %eax is a caller-save (scratch) register.

Here was the typo:

> Try changing your code so that you use the value of local after the
> call to set() -- say, make it "local += 123" -- and see the
> difference. My copy of GCC moves local to %ebx, which is a caller-save
> register, and the location list shows it live in that register all the
> way through the call and return.

%ebx is a *callee-save* (preserved) register.

I always have to think twice and I still get callee-save and
caller-save backwards! That's why I prefer the terms "scratch" and

Sorry for the confusion. David correctly said it was a caller-save
register in his original mail, and if I hadn't thought "callee-save"
instead, I'd have been able to answer his question straight away.


More information about the Dwarf-Discuss mailing list