Re: [patch] mips-tdep: info registers

Joel Brobecker
2009-02-23T02:08:35Z

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

Surprisingly, this feature is not documented yet. The documentation
mentions "info registers regname", but not "info registers regno".
Would you mind adding a line or two and sending a (separate) patch
to this list? Eli is the documentation guru...

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

> 2009-02-12 Aleksandar Ristovski <aristovski@qnx.com>
>
> * mips-tdep.c (mips_print_registers_info): Map raw register number to
> pseudo register.

This seems reasonable to me.

Just being a documentation freak, can you provide a more detailed
comment about what is happening and what you are doing?
Below is my suggestion - adjust as you think is best...

> - gdb_assert (regnum >= gdbarch_num_regs (gdbarch));
> + if (regnum < gdbarch_num_regs (gdbarch)
> + && regnum >= 0)
> + regnum += gdbarch_num_regs (gdbarch); /* Print pseudo register. */

/* If given a raw register number, convert it to its associated
pseudo register number first, since the rest of this code requires
a pseudo register. */

Pre-approved with the addition of the comment requested. Can you also
confirm that you were able to check this change against the testsuite?
I don't see how this could negatively affect the debugger, but you
never know sometimes...

Thanks,
--
Joel