This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Don't overshoot when executing cfa instructions
On Mon, Jun 29, 2009 at 03:19:09PM +0200, Andreas Schwab wrote:
> Daniel Jacobowitz <drow@false.org> writes:
>
> > Actually, before approving this I have a question. What about state
> > changes caused by the branch?
> >
> > I remember a similar problem with location lists. Before the branch,
> > a variable lives at some location. Inside the called function, it is
> > gone. Did we ever find a representation for that? Does it rely
> > on the instruction after the branch marking the register as clobbered?
>
> Do you have a testcase, or a hint how to create one?
We currently deal with this by implicit knowledge of the ABI
(dwarf2_init_reg methods). I couldn't coax either GCC or RealView
into producing an example, but here's what I was thinking of:
foo:
.cfi_startproc
mov sp, fp
.cfi_def_cfa_register fp
push r0
push r1
bl bar @ clobber r0, r1, r2
.cfi_offset r0, -4
.cfi_offset r1, -8
.cfi_undefined r2
pop r0, r1
.cfi_same_value r0
.cfi_same_value r1
ret
I think this CFI is unlikely, but correct. At "bl bar" r1 can be
found in r1. After that instruction it must be found on the stack.
GCC already combines pushes in this way although it will place the CFI
after the last push. But if it emitted full undefined markers,
isn't that where the r2 marker would have to go?
--
Daniel Jacobowitz
CodeSourcery