This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix "set debug target 1"
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 26 Aug 2008 14:43:22 +0200 (CEST)
- Subject: [commit] Fix "set debug target 1"
Hello,
"set debug target 1" currently causes an infinite recursion due the
debug_print_register function using "regcache_cooked_read", which
calls back into target_fetch_registers (and thus debug_print_register).
This is bogus; for debug purposes, we should use regcache_raw_collect
to just look at the existing regcache contents. Also, at this point
we get called for raw registers only, anyway.
Fixed by the patch below. Tested on powerpc-linux, committed to mainline.
Bye,
Ulrich
ChangeLog:
* target.c (debug_print_register): Use regcache_raw_collect
instead of regcache_cooked_read. Only handle raw registers.
diff -urNp src-orig/gdb/target.c src/gdb/target.c
--- src-orig/gdb/target.c 2008-08-23 21:43:55.000000000 +0200
+++ src/gdb/target.c 2008-08-25 17:47:23.990649224 +0200
@@ -2559,18 +2559,17 @@ debug_print_register (const char * func,
struct gdbarch *gdbarch = get_regcache_arch (regcache);
fprintf_unfiltered (gdb_stdlog, "%s ", func);
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)
+ if (regno >= 0 && regno < gdbarch_num_regs (gdbarch))
{
int i, size = register_size (gdbarch, regno);
unsigned char buf[MAX_REGISTER_SIZE];
- regcache_cooked_read (regcache, regno, buf);
+ regcache_raw_collect (regcache, regno, buf);
fprintf_unfiltered (gdb_stdlog, " = ");
for (i = 0; i < size; i++)
{
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com