Re: [rfc] [00/16] Get rid of current gdbarch

Ulrich Weigand
2007-10-08T14:01:46Z

Daniel Jacobowitz wrote:
> On Mon, Oct 08, 2007 at 03:02:51PM +0200, Ulrich Weigand wrote:
> > You should not call get_current_frame at this point; this might
> > in fact fail as there is not necessarily a current frame selected
> > at the point this callback is called.
> >
> > Instead, you should change the XXX_reg_to_regnum gdbarch entries
> > from type "f" to "m"; then the functions will be automatically
> > provided with a gdbarch parameter. (This should be a separate
> > patch from the remaining trivial current_gdbarch replacements.)
>
> /* This will hopefully provoke a warning. */
> - return gdbarch_num_regs (current_gdbarch)
> - + gdbarch_num_pseudo_regs (current_gdbarch);
> + return gdbarch_num_regs (gdbarch)
> + + gdbarch_num_pseudo_regs (gdbarch);
>
> That's the only thing it's used for. Does it provoke a warning? If
> not, maybe -1 or something similar should...

Agreed for that particular usage. In general, the reg_to_regnum
routines should probably still be converted to "m" -- e.g. the
rs6000 versions do make non-trivial use of the gdbarch ...

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com