This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [6/8] Get rid of current_gdbarch in monitor.c
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Tue, 09 Oct 2007 13:38:22 +0200
- Subject: [rfc] [6/8] Get rid of current_gdbarch in monitor.c
Hi,
this patch gets rid of some of the current_gdbarch's in monitor.c
Is this ok to commit?
ChangeLog:
* monitor.c (monitor_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
(monitor_fetch_register, monitor_fetch_registers)
(monitor_store_register, monitor_store_registers): Likewise.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/monitor.c dev/gdb/monitor.c
--- src/gdb/monitor.c 2007-08-23 20:08:36.000000000 +0200
+++ dev/gdb/monitor.c 2007-10-09 10:46:26.000000000 +0200
@@ -883,7 +883,9 @@ monitor_supply_register (struct regcache
/* supply register stores in target byte order, so swap here */
- store_unsigned_integer (regbuf, register_size (current_gdbarch, regno), val);
+ store_unsigned_integer (regbuf,
+ register_size (get_regcache_arch (regcache), regno),
+ val);
regcache_raw_supply (regcache, regno, regbuf);
@@ -1190,7 +1192,7 @@ monitor_fetch_register (struct regcache
spaces, but stop reading if something else is seen. Some monitors
like to drop leading zeros. */
- for (i = 0; i < register_size (current_gdbarch, regno) * 2; i++)
+ for (i = 0; i < register_size (get_regcache_arch (regcache), regno) * 2; i++)
{
int c;
c = readchar (timeout);
@@ -1277,7 +1279,8 @@ monitor_fetch_registers (struct regcache
return;
}
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0; regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
monitor_fetch_register (regcache, regno);
}
else
@@ -1307,7 +1310,8 @@ monitor_store_register (struct regcache
regcache_cooked_read_unsigned (regcache, regno, &val);
monitor_debug ("MON storeg %d %s\n", regno,
- phex (val, register_size (current_gdbarch, regno)));
+ phex (val,
+ register_size (get_regcache_arch (regcache), regno)));
/* send the register deposit command */
@@ -1354,7 +1358,8 @@ monitor_store_registers (struct regcache
return;
}
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0; regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
monitor_store_register (regcache, regno);
}