[PATCH] MIPS: Fix pc_regnum and sp_regnum initialisation

Joel Brobecker brobecker@adacore.com
Thu Dec 8 08:31:00 GMT 2011


>  Register numbers used for pc_regnum and sp_regnum are in the cooked range 
> and therefore depend on the total number of registers.  At some point the 
> MIPS/Linux OS ABI initialiser has been changed such that it may change the 
> number of available registers to add the artificial "restart" register.  
> Therefore cooked register numbers stored in gdbarch may only be 
> initialised once the OS ABI initialiser has run.

Ugh...

> 2011-12-06  Maciej W. Rozycki  <macro@codesourcery.com>
> 
> 	gdb/
> 	* mips-tdep.c (mips_gdbarch_init): Only set pc_regnum and
> 	sp_regnum once the gdbarch_init_osabi hook has been called.

Thanks. This looks OK to me.

> +  /* The hook may have adjusted num_regs, fetch the final value and
> +     set pc_regnum and sp_regnum now that it has been fixed.  */
> +  /* FIXME: cagney/2003-11-15: For MIPS, hasn't gdbarch_pc_regnum been
> +     replaced by gdbarch_read_pc?  */

It'd be interesting to answer Andrew's question, but that's for another
rainy day (that would mean tomorrow if you lived in Vancouver :-).

-- 
Joel



More information about the Gdb-patches mailing list