Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] mips-tdep: info registers
@ 2009-02-12 16:24 Aleksandar Ristovski
  2009-02-23  2:52 ` Joel Brobecker
  0 siblings, 1 reply; 29+ messages in thread
From: Aleksandar Ristovski @ 2009-02-12 16:24 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

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


[-- Attachment #2: mips-tdep.c-info-registers-20090212.diff.ChangeLog --]
[-- Type: text/plain, Size: 146 bytes --]

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

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


[-- Attachment #3: mips-tdep.c-info-registers-20090212.diff --]
[-- Type: text/x-patch, Size: 743 bytes --]

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"));
 

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2009-04-01 19:16 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-12 16:24 [patch] mips-tdep: info registers Aleksandar Ristovski
2009-02-23  2:52 ` Joel Brobecker
2009-02-23  3:00   ` Daniel Jacobowitz
2009-02-23  3:13     ` Joel Brobecker
2009-02-23  8:53       ` Eli Zaretskii
2009-02-23 16:18         ` Aleksandar Ristovski
2009-02-24  1:32           ` Eli Zaretskii
2009-02-23  8:56     ` Mark Kettenis
2009-02-23 16:26       ` Aleksandar Ristovski
2009-02-23 17:15         ` Daniel Jacobowitz
2009-02-23 17:36           ` Joel Brobecker
2009-02-23 18:24             ` Aleksandar Ristovski
2009-02-23 20:02               ` Aleksandar Ristovski
2009-02-27 20:36                 ` Joel Brobecker
2009-03-04 21:47                   ` Aleksandar Ristovski
2009-03-05 19:12                     ` Joel Brobecker
2009-03-05 19:22                       ` Daniel Jacobowitz
2009-03-05 19:27                         ` Aleksandar Ristovski
2009-03-05 19:35                           ` Daniel Jacobowitz
2009-03-05 22:50                             ` Joel Brobecker
2009-03-05 23:08                               ` Daniel Jacobowitz
2009-03-06  5:00                                 ` Aleksandar Ristovski
2009-03-06 12:25                                   ` Daniel Jacobowitz
2009-03-06 14:52                                     ` Aleksandar Ristovski
2009-04-01 18:50                                       ` Joel Brobecker
2009-04-01 19:16                                         ` Aleksandar Ristovski
2009-02-24 20:24               ` Maciej W. Rozycki
2009-02-25  2:15                 ` Aleksandar Ristovski
2009-02-25  7:04                   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox