This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


   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!

[tell me about it :-)]


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 */

Please, anything but a 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?

Yes. Stores could otherwize go to the wrong register (a really horrible bug to track down).


I should note that the part of ``info registers'' where it prints out where a register was saved needs a re-think. Now that things are recursive it has the potential for reporting a register that was saved N levels further in on the stack (it does this already with the d10v and PC vs LR).

BTW, suggest adding a few name prefixes to register number variables - it is really hard to know which space (DWARF 2 or GDB) the register's value falls in.

Andrew



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]