This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc][4/13] Eliminate read_register: read_register in deprecated_mips_set_processor_regs_hack
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 7 Jun 2007 22:58:31 +0200 (CEST)
- Subject: [rfc][4/13] Eliminate read_register: read_register in deprecated_mips_set_processor_regs_hack
Hello,
one more weird global register access in a tdep file:
deprecated_mips_set_processor_regs_hack in mips-tdep.c.
(Not sure if this is still required, or if it could be replaced by
the new XML register mechanism ...)
To be able to continue elimination of read_register, this patch simply
inlines the definition and reads from current_regcache. This should
obviously have no change in behaviour.
Bye,
Ulrich
ChangeLog:
* mips-tdep.c (deprecated_mips_set_processor_regs_hack): Read from
current regcache instead of calling read_register.
diff -urNp gdb-orig/gdb/mips-tdep.c gdb-head/gdb/mips-tdep.c
--- gdb-orig/gdb/mips-tdep.c 2007-06-06 18:57:02.982185081 +0200
+++ gdb-head/gdb/mips-tdep.c 2007-06-06 18:56:16.508824426 +0200
@@ -4314,10 +4314,10 @@ void
deprecated_mips_set_processor_regs_hack (void)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- CORE_ADDR prid;
-
- prid = read_register (MIPS_PRID_REGNUM);
+ ULONGEST prid;
+ regcache_cooked_read_unsigned (current_regcache,
+ MIPS_PRID_REGNUM, &prid);
if ((prid & ~0xf) == 0x700)
tdep->mips_processor_reg_names = mips_r3041_reg_names;
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com