This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] [00/16] Get rid of current gdbarch
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: drow at false dot org (Daniel Jacobowitz)
- Cc: deuling at de dot ibm dot com (Markus Deuling), gdb-patches at sourceware dot org (GDB Patches), eliz at gnu dot org (Eli Zaretskii), brobecker at adacore dot com (Joel Brobecker), jimb at codesourcery dot com (Jim Blandy), rearnsha at arm dot com, mark dot kettenis at xs4all dot nl (Mark Kettenis)
- Date: Mon, 8 Oct 2007 16:01:36 +0200 (CEST)
- Subject: Re: [rfc] [00/16] Get rid of current gdbarch
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