Re: [PATCH/i386newframe/RFC] DWARF CFI frame unwinder

Mark Kettenis
2003-05-05T13:48:28Z

Date: Sun, 04 May 2003 23:35:27 -0400
From: Andrew Cagney <ac131313@redhat.com>

Mark, fyi,

> + case REG_SAVED_REG:
> + *optimizedp = 0;
> + *lvalp = lval_register;
> + *addrp = 0;
> + *realnump = DWARF2_REG_TO_REGNUM (cache->reg[regnum].loc.reg);
> + if (valuep)
> + {
> + /* Read the value from the register. */
> + frame_unwind_register (next_frame, *realnump, valuep);
> + }
> + break;
> +

Set *addrp to the register offset hack (Otherwize something mysterious
fails. What? I don't remember).

Yes, findvar.c:value_of_register() and findvar.c:value_from_register()
use this. Worse, our whole value subsystem seems to rely on this.
Ughh, that's really gross. We should do something about that!

Anyway. Thinking about it a bit more, I suspect the whole handling of
REG_SAVED_REG is wrong. Instead, we should just change the register
number according to the DWARF CFI rule and let the unwinder for
NEXT_FRAME handle the request:

case REG_SAVED_REG:
regnum = DWARF2_REG_TO_REGNUM (cache->reg[regnum].loc.reg);
/* FALLTHROUGH */

case REG_UNMODIFIED:
frame_register_unwind (next_frame, regnum,
optimizedp, lvalp, addrp, realnump, valuep);
break;

Eventually this means that sentinel_frame_prev_register will provide
the register offset hack.

Do you agree with my analysis?

Mark