[Dwarf-Discuss] how to find local variable stored in register

Frank Ch. Eigler fche@redhat.com
Tue Feb 5 19:22:46 GMT 2008


Hi -

> > >> [...]
> > >>>> Suppose this foo() funciton call another function, then this
> > >>>> register value will get stored in stack before invoking the function
> > >>>> call.
> > >>> A truthful compiler will add extra location records for this variable
> > >>> for the time (PC ranges) when its value is on the stack.
> > >> DWARF does not describe where variables are saved as result of a
> > >> function call.  This is specified by the processor ABI.
> > >
> > > A close reading of the original posting shows ... "before invoking the
> > > function call" ... that is during the function call setup instructions
> > > within the *caller*.  DWARF should indeed describe the saved location
> > > of the variable in these regions AFAIK.
> >
> > The register is stored as part of the calling convention.
> > DWARF does not duplicate information contained in the ABI
> > specification.

> [...]
> In the case of registers saved by the caller, I've never seen an ABI
> specify where the caller must save them.  In such a case, there's
> really no way for a consumer to find those variables while there are
> younger function calls in progress, so I would hope a DWARF producer
> would provide location lists to cover the call sites.

It's even worse than that.  Considering that DWARF does not identify
those spots in a caller where "function call setup" is going on - the
instructions before the actual call - a debuginfo consumer would have
no way of knowing when to switch to this hypothetical implicit
ABI-specified location for saved registers.  Like I said, a truthful
compiler would have to spell it out.

(BTW, this seems like a special case of live range splitting.)


- FChE




More information about the Dwarf-discuss mailing list