This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: /gdb/regcache.c question
On Sun, Apr 02, 2006 at 03:49:44PM +0200, Mark Kettenis wrote:
> No, the bug is that the code that parses your collect command is
> asking for the type of a register number that doesn't exist. That
> typo should have been caught much earlier before register_type() was
> called.
The most useful thing to provide when you hit an abort is the
backtrace. Then we can figure out where the real bug is.
This one's easy to reproduce. regnum == 51, descr->nr_cooked_registers
== 50. It turns out that the problem is "user registers", which are
implemented sort of off to the side of the regcache.
user_reg_map_name_to_regnum returns 51 for i386's "pc".
0 <= x < NUM_REGS : raw registers
NUM_REGS <= x < NUM_REGS + NUM_PSEUDO_REGS : cooked pseudo registers
NUM_REGS + NUM_PSEUDO_REGS <= x : "user" registers
The only thing that user registers have is a value, and you can get at
their type through the value. The user-regs and std-regs
infrastructure isn't much used; I don't know what the plan was for it.
I don't think we can collect user registers without changing the
interface.
It is only used for $pc, $sp, $fp, and $ps. For $sp and $ps it either
returns a normal register or an error. For $fp and $pc it's a bit more
complicated.
Anyway, for now the easiest thing to do would be to refuse to collect
registers >= NUM_REGS + NUM_PSEUDO_REGS.
--
Daniel Jacobowitz
CodeSourcery