summaryrefslogtreecommitdiff
path: root/gdb/spu-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2010-06-19 17:59:05 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2010-06-19 17:59:05 +0000
commit6b7be6f008edaa3c2bcdcadcd88724cf4868601a (patch)
treeb472841154c9c159b37417892005b617b93fd523 /gdb/spu-tdep.c
parent21f120f5227d635d6151668d12234a6fd32897b2 (diff)
downloadgdb-6b7be6f008edaa3c2bcdcadcd88724cf4868601a.tar.gz
* spu-tdep.c (spu_frame_unwind_cache): Use LSLR register
value instead of hard-coded SPU_LS_SIZE. (spu_software_single_step): Likewise. * spu-tdep.h (SPU_LS_SIZE): Remove.
Diffstat (limited to 'gdb/spu-tdep.c')
-rw-r--r--gdb/spu-tdep.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 072ae8c7340..b3f50a1e9c1 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -987,8 +987,14 @@ spu_frame_unwind_cache (struct frame_info *this_frame,
{
CORE_ADDR reg;
LONGEST backchain;
+ ULONGEST lslr;
int status;
+ /* Get local store limit. */
+ lslr = get_frame_register_unsigned (this_frame, SPU_LSLR_REGNUM);
+ if (!lslr)
+ lslr = (ULONGEST) -1;
+
/* Get the backchain. */
reg = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM);
status = safe_read_memory_integer (SPUADDR (id, reg), 4, byte_order,
@@ -996,10 +1002,10 @@ spu_frame_unwind_cache (struct frame_info *this_frame,
/* A zero backchain terminates the frame chain. Also, sanity
check against the local store size limit. */
- if (status && backchain > 0 && backchain < SPU_LS_SIZE)
+ if (status && backchain > 0 && backchain <= lslr)
{
/* Assume the link register is saved into its slot. */
- if (backchain + 16 < SPU_LS_SIZE)
+ if (backchain + 16 <= lslr)
info->saved_regs[SPU_LR_REGNUM].addr = SPUADDR (id, backchain + 16);
/* Frame bases. */
@@ -1501,6 +1507,7 @@ spu_software_single_step (struct frame_info *frame)
unsigned int insn;
int offset, reg;
gdb_byte buf[4];
+ ULONGEST lslr;
pc = get_frame_pc (frame);
@@ -1508,13 +1515,18 @@ spu_software_single_step (struct frame_info *frame)
return 1;
insn = extract_unsigned_integer (buf, 4, byte_order);
+ /* Get local store limit. */
+ lslr = get_frame_register_unsigned (frame, SPU_LSLR_REGNUM);
+ if (!lslr)
+ lslr = (ULONGEST) -1;
+
/* Next sequential instruction is at PC + 4, except if the current
instruction is a PPE-assisted call, in which case it is at PC + 8.
Wrap around LS limit to be on the safe side. */
if ((insn & 0xffffff00) == 0x00002100)
- next_pc = (SPUADDR_ADDR (pc) + 8) & (SPU_LS_SIZE - 1);
+ next_pc = (SPUADDR_ADDR (pc) + 8) & lslr;
else
- next_pc = (SPUADDR_ADDR (pc) + 4) & (SPU_LS_SIZE - 1);
+ next_pc = (SPUADDR_ADDR (pc) + 4) & lslr;
insert_single_step_breakpoint (gdbarch,
aspace, SPUADDR (SPUADDR_SPU (pc), next_pc));
@@ -1531,7 +1543,7 @@ spu_software_single_step (struct frame_info *frame)
target += extract_unsigned_integer (buf, 4, byte_order) & -4;
}
- target = target & (SPU_LS_SIZE - 1);
+ target = target & lslr;
if (target != next_pc)
insert_single_step_breakpoint (gdbarch, aspace,
SPUADDR (SPUADDR_SPU (pc), target));