This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Fix d10v's PC unwind
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 10 Mar 2003 09:45:07 -0500
- Subject: [commit] Fix d10v's PC unwind
Hello,
The attached fixes the d10v's register unwinder so that it correctly
unwinds the PC register.
committed,
Andrew
2003-03-10 Andrew Cagney <cagney at redhat dot com>
* d10v-tdep.c (d10v_frame_register_unwind): Correctly unwind the
PC.
(d10v_frame_pop): Unwind the PC, and not the LR, when restoring
the PC register.
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.83
diff -u -r1.83 d10v-tdep.c
--- d10v-tdep.c 5 Mar 2003 23:14:17 -0000 1.83
+++ d10v-tdep.c 10 Mar 2003 14:42:27 -0000
@@ -1557,8 +1557,19 @@
int *realnump, void *bufferp)
{
struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache);
- saved_regs_unwinder (frame, info->saved_regs, regnum, optimizedp,
- lvalp, addrp, realnump, bufferp);
+ if (regnum == PC_REGNUM)
+ {
+ /* The call instruction saves the caller's PC in LR. The
+ function prologue of the callee may then save the LR on the
+ stack. Find that possibly saved LR value and return it. */
+ saved_regs_unwinder (frame, info->saved_regs, LR_REGNUM, optimizedp,
+ lvalp, addrp, realnump, bufferp);
+ }
+ else
+ {
+ saved_regs_unwinder (frame, info->saved_regs, regnum, optimizedp,
+ lvalp, addrp, realnump, bufferp);
+ }
}
@@ -1587,7 +1598,7 @@
frame_unwind_register (fi, PSW_REGNUM, raw_buffer);
regcache_cooked_write (regcache, PSW_REGNUM, raw_buffer);
- frame_unwind_register (fi, LR_REGNUM, raw_buffer);
+ frame_unwind_register (fi, PC_REGNUM, raw_buffer);
regcache_cooked_write (regcache, PC_REGNUM, raw_buffer);
store_unsigned_integer (raw_buffer,