This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]