This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Problem setting registers if stack point or frame pointer is 0
- From: Antony KING <antony dot king at st dot com>
- To: gdb at sourceware dot org
- Date: Thu, 03 Apr 2008 22:35:41 +0100
- Subject: Problem setting registers if stack point or frame pointer is 0
Hi,
I have a problem trying to set a CPU register (using the GDB convenience
variable mechanism) if the stack pointer (SP) or frame pointer (FP) CPU
registers are 0. For example on an SH-4 device, where the FP register is
R14 and the SP register is R15, I see the following error from GDB (6.7.1):
(gdb) <commands to connect to SH-4 target>
(gdb) set $r15 = 0
(gdb) set $pc = 0xa0000000
Value being assigned to is no longer active.
(gdb)
The error is being generated by value_assign() (valops.c) in the
following code sequence:
case lval_register:
{
struct frame_info *frame;
int value_reg;
/* Figure out which frame this is in currently. */
frame = frame_find_by_id (VALUE_FRAME_ID (toval));
value_reg = VALUE_REGNUM (toval);
if (!frame)
error (_("Value being assigned to is no longer active."));
I can make the problem "go away" if I insert the following after the
call to frame_find_by_id() in the above code:
if (!frame)
frame = get_current_frame();
This solution was "suggestion" by a source comment in the implementation
of frame_find_by_id(). Is this the right solution do you think ?
(I am not familiar with the frame management of GDB so I thought I
would ask those more in the know about this aspect of GDB internals :-).
Cheers,
Antony.