[rfc] [8/8] Eliminate current_gdbarch from *-tdep.c: nto
Ulrich Weigand
uweigand@de.ibm.com
Wed Aug 27 18:07:00 GMT 2008
Hello,
i386nto_register_area is another case where the appropriate per-regcache
architecture is available to the caller and simply needs to be passed in.
Bye,
Ulrich
ChangeLog:
* nto-tdep.h (struct nto_target_ops): Add gdbarch parameter to
register_area callback function.
* i386-nto-tdep.c (i386nto_register_area): Add gdbarch parameter.
Use it instead of current_gdbarch.
* nto-procfs.c (procfs_store_registers): Update call.
diff -urNp gdb-orig/gdb/i386-nto-tdep.c gdb-head/gdb/i386-nto-tdep.c
--- gdb-orig/gdb/i386-nto-tdep.c 2008-08-26 00:05:35.000000000 +0200
+++ gdb-head/gdb/i386-nto-tdep.c 2008-08-26 00:06:38.000000000 +0200
@@ -131,7 +131,8 @@ i386nto_regset_id (int regno)
}
static int
-i386nto_register_area (int regno, int regset, unsigned *off)
+i386nto_register_area (struct gdbarch *gdbarch,
+ int regno, int regset, unsigned *off)
{
int len;
@@ -166,8 +167,7 @@ i386nto_register_area (int regno, int re
if (regno == -1)
return regset_size;
- *off = (regno - gdbarch_fp0_regnum (current_gdbarch))
- * regsize + off_adjust;
+ *off = (regno - gdbarch_fp0_regnum (gdbarch)) * regsize + off_adjust;
return 10;
/* Why 10 instead of regsize? GDB only stores 10 bytes per FP
register so if we're sending a register back to the target,
diff -urNp gdb-orig/gdb/nto-procfs.c gdb-head/gdb/nto-procfs.c
--- gdb-orig/gdb/nto-procfs.c 2008-08-26 00:05:35.000000000 +0200
+++ gdb-head/gdb/nto-procfs.c 2008-08-26 00:06:38.000000000 +0200
@@ -1194,7 +1194,8 @@ procfs_store_registers (struct regcache
if (dev_set == -1)
return;
- len = nto_register_area (regno, regset, &off);
+ len = nto_register_area (get_regcache_arch (regcache),
+ regno, regset, &off);
if (len < 1)
return;
diff -urNp gdb-orig/gdb/nto-tdep.h gdb-head/gdb/nto-tdep.h
--- gdb-orig/gdb/nto-tdep.h 2008-08-26 00:05:35.000000000 +0200
+++ gdb-head/gdb/nto-tdep.h 2008-08-26 00:06:38.000000000 +0200
@@ -61,7 +61,7 @@ struct nto_target_ops
and stuff it into the last argument. If regno is -1, calculate the
size of the entire regset. Returns length of data, -1 if unknown
regset, 0 if unknown register. */
- int (*register_area) (int, int, unsigned *);
+ int (*register_area) (struct gdbarch *, int, int, unsigned *);
/* Build the Neutrino register set info into the data buffer.
Return -1 if unknown regset, 0 otherwise. */
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
More information about the Gdb-patches
mailing list