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: deuling at de dot ibm dot com (Markus Deuling)
- Cc: 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 15:02:51 +0200 (CEST)
- Subject: Re: [rfc] [00/16] Get rid of current gdbarch
Markus Deuling wrote:
> This patch set replaces some of the current_gdbarch's in following files:
>
> * aix-thread.c
> * arm-tdep.c
> * alpha-{linux-nat,nat,tdep}.c
> * findvar.c
> * amd64-{nat,tdep}.c
> * i386-tdep.c
> * sh[64]-tdep.c
> * remote.c
> * irix5-nat.c
> * regcache.c
> * m68k{linux-nat, linux-tdep, -tdep}.c
> * dwarf2{loc, -frame}.c
> * cris-tdep.c
> * hppa-{hpux-nat, hpux-tdep, linux-nat, tdep}.c
I've checked all of those in, except for the i386-tdep.c one:
@@ -169,6 +169,8 @@ i386_register_name (int regnum)
static int
i386_dbx_reg_to_regnum (int reg)
{
+ struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
+
/* This implements what GCC calls the "default" register map
(dbx_register_map[]). */
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.)
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com