On s390x-linux, I run into:
...
(gdb) python print(u[u_fields[0]])^M
99^M
(gdb) PASS: gdb.python/py-value-cc.exp: u's first field via field
python print(u[u_fields[1]])^M
0 '\000'^M
(gdb) FAIL: gdb.python/py-value-cc.exp: u's second field via field
...
There's a var u of this type:
...
union U {
int a;
char c;
};
...
and after assigning 99 to u.a, the test-case expects u.c to contain 99 (which
it does on x86_64), but instead it contains 0.
Fix this by instead assigning 0x63636363, to ensure that u.c == 99 for both
little and big endian.
Tested on x86_64-linux and s390x-linux.
Btd &b_td = b1;
U u;
- u.a = 99;
+ u.a = 0x63636363;
X x;
x.x = 101;
gdb_test "python print(b_td\[b_fields\[0\]\]\['a'\])" "100" \
"b_td.A::a via field"
-gdb_test "python print(u\[u_fields\[0\]\])" "99.*" "u's first field via field"
+gdb_test "python print(hex(u\[u_fields\[0\]\]))" "0x63636363.*" \
+ "u's first field via field"
gdb_test "python print(u\[u_fields\[1\]\])" "99.*" "u's second field via field"
gdb_test "python print(len(x_fields))" "2" "number for fields in u"