Blame SOURCES/gdb-rhbz1125820-ppc64le-enablement-26of37.patch

2c2fa1
commit 084ee54552f6c35d740e8b9bc81a4fe8d8bb178b
2c2fa1
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
Date:   Tue Feb 4 18:31:38 2014 +0100
2c2fa1
2c2fa1
    PowerPC64 little-endian fixes: VSX tests and pseudo-regs
2c2fa1
    
2c2fa1
    Many VSX test were failing on powerpc64le-linux, since -as opposed to the
2c2fa1
    AltiVec tests- there never were little-endian versions of the test patterns.
2c2fa1
    
2c2fa1
    This patch adds such patterns, along the lines of altivec-regs.exp.
2c2fa1
    
2c2fa1
    In addition, there is an actual code change required: For those VSX
2c2fa1
    registers that overlap a floating-point register, the FP register
2c2fa1
    overlaps the most-significant half of the VSX register both on big-
2c2fa1
    and little-endian systems.  However, on little-endian systems, that
2c2fa1
    half is stored at an offset of 8 bytes (not 0).  This works already
2c2fa1
    for the "real" FP registers, but current code gets it wrong for
2c2fa1
    the "extended" pseudo FP register GDB generates for the second
2c2fa1
    half of the VSX register bank.
2c2fa1
    
2c2fa1
    This patch updates the corresponding pseudo read/write routines
2c2fa1
    to take the appropriate offset into consideration.
2c2fa1
    
2c2fa1
    gdb/ChangeLog:
2c2fa1
    
2c2fa1
    	* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
2c2fa1
    	of the overlapped FP register within the VSX register on little-
2c2fa1
    	endian platforms.
2c2fa1
    	(efpr_pseudo_register_write): Likewise.
2c2fa1
    
2c2fa1
    gdb/testsuite/ChangeLog:
2c2fa1
    
2c2fa1
    	* gdb.arch/vsx-regs.exp: Check target endianness.  Provide variants
2c2fa1
    	of the test patterns for use on little-endian systems.
2c2fa1
2c2fa1
Index: gdb-7.6.1/gdb/rs6000-tdep.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/rs6000-tdep.c
2c2fa1
+++ gdb-7.6.1/gdb/rs6000-tdep.c
2c2fa1
@@ -2830,10 +2830,12 @@ efpr_pseudo_register_read (struct gdbarc
2c2fa1
 {
2c2fa1
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2c2fa1
   int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
2c2fa1
+  int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
2c2fa1
 
2c2fa1
   /* Read the portion that overlaps the VMX register.  */
2c2fa1
-  return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
2c2fa1
-				 register_size (gdbarch, reg_nr), buffer);
2c2fa1
+  return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index,
2c2fa1
+				 offset, register_size (gdbarch, reg_nr),
2c2fa1
+				 buffer);
2c2fa1
 }
2c2fa1
 
2c2fa1
 /* Write method for POWER7 Extended FP pseudo-registers.  */
2c2fa1
@@ -2843,10 +2845,12 @@ efpr_pseudo_register_write (struct gdbar
2c2fa1
 {
2c2fa1
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2c2fa1
   int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
2c2fa1
+  int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
2c2fa1
 
2c2fa1
   /* Write the portion that overlaps the VMX register.  */
2c2fa1
-  regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
2c2fa1
-			   register_size (gdbarch, reg_nr), buffer);
2c2fa1
+  regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index,
2c2fa1
+			   offset, register_size (gdbarch, reg_nr),
2c2fa1
+			   buffer);
2c2fa1
 }
2c2fa1
 
2c2fa1
 static enum register_status
2c2fa1
Index: gdb-7.6.1/gdb/testsuite/gdb.arch/vsx-regs.exp
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/testsuite/gdb.arch/vsx-regs.exp
2c2fa1
+++ gdb-7.6.1/gdb/testsuite/gdb.arch/vsx-regs.exp
2c2fa1
@@ -58,19 +58,45 @@ if ![runto_main] then {
2c2fa1
     gdb_suppress_tests
2c2fa1
 }
2c2fa1
 
2c2fa1
+set endianness ""
2c2fa1
+set msg "detect endianness"
2c2fa1
+gdb_test_multiple "show endian" "$msg" {
2c2fa1
+    -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
2c2fa1
+        pass "$msg"
2c2fa1
+        set endianness $expect_out(2,string)
2c2fa1
+    }
2c2fa1
+    -re ".*$gdb_prompt $" {
2c2fa1
+        fail "$msg"
2c2fa1
+    }
2c2fa1
+}
2c2fa1
+
2c2fa1
 # Data sets used throughout the test
2c2fa1
 
2c2fa1
-set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.."
2c2fa1
+if {$endianness == "big"} {
2c2fa1
+    set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.."
2c2fa1
+
2c2fa1
+    set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
2c2fa1
+
2c2fa1
+    set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
2c2fa1
 
2c2fa1
-set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
2c2fa1
+    set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
2c2fa1
 
2c2fa1
-set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
2c2fa1
+    set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
2c2fa1
 
2c2fa1
-set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
2c2fa1
+    set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
2c2fa1
+} else {
2c2fa1
+    set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x0, 0x1., v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x0, 0x0, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x0, 0x0, 0x0, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.."
2c2fa1
 
2c2fa1
-set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
2c2fa1
+    set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x1, 0x1, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.."
2c2fa1
 
2c2fa1
-set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
2c2fa1
+    set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.."
2c2fa1
+
2c2fa1
+    set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.."
2c2fa1
+
2c2fa1
+    set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
2c2fa1
+
2c2fa1
+    set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
2c2fa1
+}
2c2fa1
 
2c2fa1
 set float_register ".raw 0xdeadbeefdeadbeef."
2c2fa1