Power: Correct little-endian e500v2 GPR frame offsets
authorMaciej W. Rozycki <macro@codesourcery.com>
Tue, 18 Mar 2014 19:39:41 +0000 (19:39 +0000)
committerMaciej W. Rozycki <macro@codesourcery.com>
Tue, 18 Mar 2014 19:48:14 +0000 (19:48 +0000)
This change corrects GPR frame offset calculation for the e500v2
processor.  On this target, featuring the SPE APU, GPRs are 64-bit and
are held in stack frames whole with the use of `evstdd' and `evldd'
instructions.  Their integer 32-bit part occupies the low-order word and
therefore its offset varies between the two endiannesses possible.

* rs6000-tdep.c (rs6000_frame_cache): Correct little-endian GPR
offset into SPE pseudo registers.

gdb/ChangeLog
gdb/rs6000-tdep.c

index 1c68937..4f486e9 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-18  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * rs6000-tdep.c (rs6000_frame_cache): Correct little-endian GPR
+       offset into SPE pseudo registers.
+
 2014-03-18  Pedro Alves  <palves@redhat.com>
 
        PR gdb/13860
index bec06c7..dbe3aa2 100644 (file)
@@ -3257,12 +3257,14 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache)
        {
          int i;
          CORE_ADDR ev_addr = cache->base + fdata.ev_offset;
+         CORE_ADDR off = (byte_order == BFD_ENDIAN_BIG ? 4 : 0);
+
          for (i = fdata.saved_ev; i < ppc_num_gprs; i++)
            {
              cache->saved_regs[tdep->ppc_ev0_regnum + i].addr = ev_addr;
-              cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = ev_addr + 4;
+             cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = ev_addr + off;
              ev_addr += register_size (gdbarch, tdep->ppc_ev0_regnum);
-            }
+           }
        }
     }