This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [1/5] Get rid of current_gdbarch in target.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: Mon, 22 Oct 2007 11:58:35 +0200
- Subject: [rfc] [1/5] Get rid of current_gdbarch in target.c
Hi,
this patch gets rid of some of the current_gdbarch's in target.c
Is this ok to commit?
ChangeLog:
* target.c (debug_print_register): Use get_regcache_arch to get at the
current architecture by regcache.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/target.c dev/gdb/target.c
--- src/gdb/target.c 2007-10-11 06:55:48.000000000 +0200
+++ dev/gdb/target.c 2007-10-22 10:32:02.000000000 +0200
@@ -2165,18 +2165,19 @@ static void
debug_print_register (const char * func,
struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
fprintf_unfiltered (gdb_stdlog, "%s ", func);
- if (regno >= 0 && regno < gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch)
- && gdbarch_register_name (current_gdbarch, regno) != NULL
- && gdbarch_register_name (current_gdbarch, regno)[0] != '\0')
- fprintf_unfiltered (gdb_stdlog, "(%s)", gdbarch_register_name
- (current_gdbarch, regno));
+ if (regno >= 0 && regno < gdbarch_num_regs (gdbarch)
+ + gdbarch_num_pseudo_regs (gdbarch)
+ && gdbarch_register_name (gdbarch, regno) != NULL
+ && gdbarch_register_name (gdbarch, regno)[0] != '\0')
+ fprintf_unfiltered (gdb_stdlog, "(%s)",
+ gdbarch_register_name (gdbarch, regno));
else
fprintf_unfiltered (gdb_stdlog, "(%d)", regno);
if (regno >= 0)
{
- int i, size = register_size (current_gdbarch, regno);
+ int i, size = register_size (gdbarch, regno);
unsigned char buf[MAX_REGISTER_SIZE];
regcache_cooked_read (regcache, regno, buf);
fprintf_unfiltered (gdb_stdlog, " = ");