This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Add overlay return stub comment
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 11 May 2007 22:26:31 +0200 (CEST)
- Subject: [commit] Add overlay return stub comment
Hello,
this adds a comment about the LR usage with overlay return stubs.
Bye,
Ulrich
ChangeLog:
* spu-tdep.c (spu_frame_unwind_cache): Add comment.
Index: gdb/spu-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/spu-tdep.c,v
retrieving revision 1.13
diff -c -p -r1.13 spu-tdep.c
*** gdb/spu-tdep.c 11 May 2007 19:58:38 -0000 1.13
--- gdb/spu-tdep.c 11 May 2007 20:08:19 -0000
*************** spu_frame_unwind_cache (struct frame_inf
*** 743,755 ****
/* The previous SP is equal to the CFA. */
trad_frame_set_value (info->saved_regs, SPU_SP_REGNUM, info->frame_base);
! /* The previous PC comes from the link register. In the case
! of overlay return stubs, we unwind to the real return address. */
if (trad_frame_addr_p (info->saved_regs, SPU_LR_REGNUM))
target_read_memory (info->saved_regs[SPU_LR_REGNUM].addr, buf, 16);
else
frame_unwind_register (next_frame, SPU_LR_REGNUM, buf);
if (extract_unsigned_integer (buf + 8, 4) != 0)
trad_frame_set_value (info->saved_regs, SPU_PC_REGNUM,
extract_unsigned_integer (buf + 8, 4));
--- 743,761 ----
/* The previous SP is equal to the CFA. */
trad_frame_set_value (info->saved_regs, SPU_SP_REGNUM, info->frame_base);
! /* Read full contents of the unwound link register in order to
! be able to determine the return address. */
if (trad_frame_addr_p (info->saved_regs, SPU_LR_REGNUM))
target_read_memory (info->saved_regs[SPU_LR_REGNUM].addr, buf, 16);
else
frame_unwind_register (next_frame, SPU_LR_REGNUM, buf);
+ /* Normally, the return address is contained in the slot 0 of the
+ link register, and slots 1-3 are zero. For an overlay return,
+ slot 0 contains the address of the overlay manager return stub,
+ slot 1 contains the partition number of the overlay section to
+ be returned to, and slot 2 contains the return address within
+ that section. Return the latter address in that case. */
if (extract_unsigned_integer (buf + 8, 4) != 0)
trad_frame_set_value (info->saved_regs, SPU_PC_REGNUM,
extract_unsigned_integer (buf + 8, 4));
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com