This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] mips-tdep: info registers


Hello,

This is applicable to mips targets.

When using info registers $N command, gdb_assert will be triggered if N falls in the raw register number area. However, this is counter-intuitive.

The change simply maps raw-register number to pseudo register number and continues as before.

-------------------------------------
Example: current situation

(gdb) info registers $1
../../gdb/mips-tdep.c:4307: internal-error: mips_print_registers_info:
Assertion `regnum >= gdbarch_num_regs (current_gdbarch)' failed.


Example: with the patch

(gdb) info registers $1
at: 0x8020000
--------------------------------------



Thanks,

Aleksandar Ristovski
QNX Software Systems

2009-02-12  Aleksandar Ristovski  <aristovski@qnx.com>

	* mips-tdep.c (mips_print_registers_info): Map raw register number to
	pseudo register.

Index: gdb/mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.489
diff -u -p -r1.489 mips-tdep.c
--- gdb/mips-tdep.c	3 Jan 2009 05:57:52 -0000	1.489
+++ gdb/mips-tdep.c	12 Feb 2009 16:19:02 -0000
@@ -4601,7 +4601,9 @@ mips_print_registers_info (struct gdbarc
 {
   if (regnum != -1)		/* do one specified register */
     {
-      gdb_assert (regnum >= gdbarch_num_regs (gdbarch));
+      if (regnum < gdbarch_num_regs (gdbarch)
+	  && regnum >= 0)
+	regnum += gdbarch_num_regs (gdbarch); /* Print pseudo register.  */
       if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
 	error (_("Not a valid register for the current processor type"));
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]