[rfa/6.0] Better handle unspecified CFI values

Daniel Jacobowitz drow@mvista.com
Sat Sep 6 21:34:00 GMT 2003


On Fri, Sep 05, 2003 at 08:57:57PM -0400, Andrew Cagney wrote:
> Hello,
> 
> This patch is an attempt at improving GDB's behavior when GCC "treads 
> the boundaries of the CFI specification".
> 
> It does the following:
> 
> - changes the rules REG_UNMODIFIED -> REG_SAME_VALUE and REG_UNSAVED -> 
> REG_UNDEFINED so that they better match the corresponding CFI register 
> states (I could commit this separatly).  The other names confused me :-)
> 
> - it adds a new register rule - REG_UNSPECIFIED - which is used to 
> differentiate a register that is missing CFI info from a register that 
> CFI specified as "undefined" (nee UNSAVED).
> 
> - when unwinding, it treats REG_UNSPECIFIED registers like 
> REG_SAME_VALUE but with the additional hack to map an unspecified 
> SP_REGNUM onto the CFA.
> 
> - if it detects an unspecified CFI entry it complains
> It isn't perfect though - since it doesn't know the full range of valid 
> debug info register numbers it can't check every entry.  Instead it 
> checks the range provided by CFI for unspecified holes and then 
> complains about that.  The reality is that GCC at least gets that bit 
> right (but consistently forgets the SP).
> 
> I'd like to commit the patch as is for the 6.0 branch.  For the mainline 
> though, I'd like to make the additional changes:
> 
> - delete the SP_REGNUM hack from the REG_UNDEFINED rule (it's no longer 
> needed, I think)

Leaving the hack in REG_UNSPECIFIED?  Yes, I'm pretty sure you're
right.

> - add a check/complaint for the SP v CFA problem.

Could you hold off on the complaint until there's a valid way to
specify the SP in the unwind information?  Right now there isn't one,
as I described on the dwarf2 list three weeks ago.

Otherwise this looks good to me.

> @@ -611,7 +646,9 @@
>  
>    switch (cache->reg[regnum].how)
>      {
> -    case REG_UNSAVED:
> +    case REG_UNDEFINED:
> +      /* If CFI explicitly specified that the value isn't defined,
> +	 mark it as optomized away - the value isn't available.  */

"optimized"

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gdb-patches mailing list