This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc][3/13] Eliminate read_register: read_register in mep-tdep.c current_ routines
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 7 Jun 2007 22:58:09 +0200 (CEST)
- Subject: [rfc][3/13] Eliminate read_register: read_register in mep-tdep.c current_ routines
Hello,
another place in a tdep file where global register state is accessed
in a way that isn't easily eliminable: current_me_module and
current_options in mep-tdep.c.
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:
* mep-tdep.c (current_me_module): Read from current regcache
instead of calling read_register.
(current_options): Likewise.
diff -urNp gdb-orig/gdb/mep-tdep.c gdb-head/gdb/mep-tdep.c
--- gdb-orig/gdb/mep-tdep.c 2007-06-01 18:21:39.968990155 +0200
+++ gdb-head/gdb/mep-tdep.c 2007-06-01 18:26:33.486246442 +0200
@@ -850,7 +850,12 @@ static CONFIG_ATTR
current_me_module ()
{
if (target_has_registers)
- return read_register (MEP_MODULE_REGNUM);
+ {
+ ULONGEST regval;
+ regcache_cooked_read_unsigned (current_regcache,
+ MEP_MODULE_REGNUM, ®val);
+ return regval;
+ }
else
return gdbarch_tdep (current_gdbarch)->me_module;
}
@@ -868,7 +873,12 @@ static unsigned int
current_options ()
{
if (target_has_registers)
- return read_register (MEP_OPT_REGNUM);
+ {
+ ULONGEST regval;
+ regcache_cooked_read_unsigned (current_regcache,
+ MEP_OPT_REGNUM, ®val);
+ return regval;
+ }
else
return me_module_opt (current_me_module ());
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com