+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ PR exp/16225:
+ * valprint.h (print_binary_chars, print_hex_chars): Update.
+ * valprint.c (val_print_type_code_int): Update.
+ (print_binary_chars): Add "zero_pad" argument.
+ (emit_octal_digit): New function.
+ (print_octal_chars): Don't zero-pad.
+ (print_decimal_chars): Likewise.
+ (print_hex_chars): Add "zero_pad" argument.
+ * sh64-tdep.c (sh64_do_fp_register): Update.
+ * regcache.c (regcache::dump): Update.
+ * printcmd.c (print_scalar_formatted): Update.
+ * infcmd.c (default_print_one_register_info): Update.
+
2017-06-12 Pedro Alves <palves@redhat.com>
Alan Hayward <alan.hayward@arm.com>
if (print_raw_format)
{
fprintf_filtered (file, "\t(raw ");
- print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order);
+ print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order,
+ true);
fprintf_filtered (file, ")");
}
}
print_decimal_chars (stream, valaddr, len, byte_order);
return;
case 't':
- print_binary_chars (stream, valaddr, len, byte_order);
+ print_binary_chars (stream, valaddr, len, byte_order, size > 0);
return;
case 'x':
- print_hex_chars (stream, valaddr, len, byte_order);
+ print_hex_chars (stream, valaddr, len, byte_order, size > 0);
+ return;
+ case 'z':
+ print_hex_chars (stream, valaddr, len, byte_order, true);
return;
case 'c':
print_char_chars (stream, type, valaddr, len, byte_order);
break;
case 'o':
- if (val_long)
- print_longest (stream, 'o', 1, val_long);
- else
- fprintf_filtered (stream, "0");
+ print_longest (stream, 'o', 1, val_long);
break;
case 'a':
break;
case 'z':
- print_hex_chars (stream, valaddr, len, byte_order);
+ print_hex_chars (stream, valaddr, len, byte_order, true);
break;
default:
raw_update (regnum);
print_hex_chars (file, register_buffer (regnum),
m_descr->sizeof_register[regnum],
- gdbarch_byte_order (gdbarch));
+ gdbarch_byte_order (gdbarch), true);
}
}
else
print_hex_chars (file, buf,
m_descr->sizeof_register[regnum],
- gdbarch_byte_order (gdbarch));
+ gdbarch_byte_order (gdbarch), true);
if (value != NULL)
{
fprintf_filtered (file, "\t(raw ");
print_hex_chars (file, raw_buffer,
register_size (gdbarch, regnum),
- gdbarch_byte_order (gdbarch));
+ gdbarch_byte_order (gdbarch), true);
fprintf_filtered (file, ")");
fprintf_filtered (file, "\n");
}
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ PR exp/16225:
+ * gdb.reverse/i386-sse-reverse.exp: Update tests.
+ * gdb.arch/vsx-regs.exp: Update tests.
+ * gdb.arch/s390-vregs.exp (hex128): New proc.
+ Update test.
+ * gdb.arch/altivec-regs.exp: Update tests.
+
2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/startup-with-shell.c: New file.
# b) the register read (below) also works.
if {$endianness == "big"} {
-set vector_register ".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.."
+set vector_register ".uint128 = 0x1000000010000000100000001, 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.."
} else {
-set vector_register ".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.."
+set vector_register ".uint128 = 0x1000000010000000100000001, 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.."
}
for {set i 0} {$i < 32} {incr i 1} {
# the way gdb works.
if {$endianness == "big"} {
- set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.."
+ set decimal_vector ".uint128 = 0x1000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.."
} else {
- set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.."
+ set decimal_vector ".uint128 = 0x1000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.."
}
for {set i 0} {$i < 32} {incr i 1} {
gdb_continue_to_breakpoint "change vrs"
set vregs [capture_command_output "info registers vector" ""]
+# Format a 128-bit value, given individual 4-byte values, as hex.
+# Leading zeros are suppressed.
+proc hex128 {a_high a_low b_high b_low} {
+ set result [format %08x%08x%08x%08x \
+ [expr $a_high * ($i + 1) * $a_high ] \
+ [expr $a_low * ($i + 1) * $a_low ] \
+ [expr $b_high * (32 - $i) * $b_high * 32] \
+ [expr $b_low * (32 - $i) * $b_low * 32] ]
+ return [regsub -- "^0*" $result ""]
+}
+
set j 1
foreach {- r i val} [regexp -all -inline -line \
{^(\D*)(\d+)\s+.*?uint128 = 0x([0-9a-f]+?)} $vregs] {
if { $r ne "v" } {
fail "info registers vector: bad line $j"
- } elseif { $val ne [format %08x%08x%08x%08x \
- [expr $a_high * ($i + 1) * $a_high ] \
- [expr $a_low * ($i + 1) * $a_low ] \
- [expr $b_high * (32 - $i) * $b_high * 32] \
- [expr $b_low * (32 - $i) * $b_low * 32] ] } {
+ } elseif { $val ne [hex128 $a_high $a_low $b_high $b_low] } {
fail "compare \$v$i"
}
incr j 1
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.."
- 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.."
+ set vector_register3 ".uint128 = 0x1000000010000000100000001, 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.."
- 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.."
+ set vector_register3_vr ".uint128 = 0x1000000010000000100000001, 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.."
} else {
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.."
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.."
- 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.."
+ set vector_register3 ".uint128 = 0x1000000010000000100000001, 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.."
- 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.."
+ set vector_register3_vr ".uint128 = 0x1000000010000000100000001, 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.."
}
set float_register ".raw 0xdeadbeefdeadbeef."
gdb_test "reverse-step" "orpd.*" "reverse-step to orpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse orps"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "mulss.*" "reverse-step to mulss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse orpd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "mulsd.*" "reverse-step to mulsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulss"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "mulps.*" "reverse-step to mulps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulsd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "mulpd.*" "reverse-step to mulpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulps"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "divss.*" "reverse-step to divss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulpd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "divsd.*" "reverse-step to divsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divss"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "divps.*" "reverse-step to divps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divsd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000080000000.*" \
+ "xmm1 .*uint128 = 0x80000000.*" \
"verify xmm1 after reverse divsd"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "divpd.*" "reverse-step to divpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divps"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000080000000.*" \
+ "xmm1 .*uint128 = 0x80000000.*" \
"verify xmm1 after reverse divps"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "cvtpd2ps.*" "reverse-step to cvtpd2ps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divpd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "cvtpd2dq.*" "reverse-step to cvtpd2dq"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtpd2ps"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "cvtdq2ps.*" "reverse-step to cvtdq2ps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtpd2dq"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse cvtpd2dq"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "cvtdq2pd.*" "reverse-step to cvtdq2pd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtdq2ps"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse cvtdq2ps"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "comiss.*" "reverse-step to comiss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtdq2pd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse cvtdq2pd"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "comisd.*" "reverse-step to comisd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse comiss"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse comiss"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "cmpss.*" "reverse-step to cmpss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse comisd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse comisd"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "cmpsd.*" "reverse-step to cmpsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmpss"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000000000000.*" \
+ "xmm1 .*uint128 = 0x.*" \
"verify xmm1 after reverse cmpss"
gdb_test "info register xmm2" \
gdb_test "reverse-step" "cmpps.*" "reverse-step to cmpps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmpsd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000000000000.*" \
+ "xmm1 .*uint128 = 0x.*" \
"verify xmm1 after reverse cmpsd"
gdb_test "info register xmm2" \
- "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm2 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm2 after reverse cmpsd"
gdb_test "reverse-step" "cmppd.*" "reverse-step to cmppd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmpps"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm1 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm1 after reverse cmpps"
gdb_test "info register xmm2" \
- "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm2 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm2 after reverse cmpps"
gdb_test "reverse-step" "andps.*" "reverse-step to andps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmppd"
gdb_test "info register xmm1" \
"verify xmm1 after reverse cmppd"
gdb_test "info register xmm2" \
- "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm2 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm2 after reverse cmppd"
gdb_test "reverse-step" "andpd.*" "reverse-step to andpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse andps"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "addsubps.*" "reverse-step to addsubps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse andpd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "addsubpd.*" "reverse-step to addsubpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse addsubps"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "addss.*" "reverse-step to addss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addsubpd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "addsd.*" "reverse-step to addsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addss"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "addps.*" "reverse-step to addps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addsd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "addpd.*" "reverse-step to addpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addps"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "pabsd.*" "reverse-step to pabsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse pabsd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "pabsw.*" "reverse-step to pabsw"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse pabsw"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "pabsb.*" "reverse-step to pabsb"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse pabsb"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "blendvps.*" "reverse-step to blendvps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09082726252413121110.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09082726252413121110.*" \
"verify xmm0 at end of sse4_test"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "blendvpd.*" "reverse-step to blendvpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09082726252413121110.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09082726252413121110.*" \
"verify xmm0 after reverse blendvps"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "blendps.*" "reverse-step to blendps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09081716151413121110.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09081716151413121110.*" \
"verify xmm0 after reverse blendvpd"
gdb_test "info register xmm1" \
gdb_test "reverse-step" "blendpd.*" "reverse-step to blendpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse blendps"
gdb_test "info register xmm1" \
complement (a reasonable assumption, I think) and do
better than this. */
print_hex_chars (stream, (unsigned char *) valaddr,
- TYPE_LENGTH (type), byte_order);
+ TYPE_LENGTH (type), byte_order, false);
}
}
else
void
print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
- unsigned len, enum bfd_endian byte_order)
+ unsigned len, enum bfd_endian byte_order, bool zero_pad)
{
#define BITS_IN_BYTES 8
const gdb_byte *p;
unsigned int i;
int b;
+ bool seen_a_one = false;
/* Declared "int" so it will be signed.
This ensures that right shift will shift in zeros. */
const int mask = 0x080;
- /* FIXME: We should be not printing leading zeroes in most cases. */
-
if (byte_order == BFD_ENDIAN_BIG)
{
for (p = valaddr;
for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
{
if (*p & (mask >> i))
- b = 1;
+ b = '1';
else
- b = 0;
+ b = '0';
- fprintf_filtered (stream, "%1d", b);
+ if (zero_pad || seen_a_one || b == '1')
+ fputc_filtered (b, stream);
+ if (b == '1')
+ seen_a_one = true;
}
}
}
for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
{
if (*p & (mask >> i))
- b = 1;
+ b = '1';
else
- b = 0;
+ b = '0';
- fprintf_filtered (stream, "%1d", b);
+ if (zero_pad || seen_a_one || b == '1')
+ fputc_filtered (b, stream);
+ if (b == '1')
+ seen_a_one = true;
}
}
}
+
+ /* When not zero-padding, ensure that something is printed when the
+ input is 0. */
+ if (!zero_pad && !seen_a_one)
+ fputc_filtered ('0', stream);
+}
+
+/* A helper for print_octal_chars that emits a single octal digit,
+ optionally suppressing it if is zero and updating SEEN_A_ONE. */
+
+static void
+emit_octal_digit (struct ui_file *stream, bool *seen_a_one, int digit)
+{
+ if (*seen_a_one || digit != 0)
+ fprintf_filtered (stream, "%o", digit);
+ if (digit != 0)
+ *seen_a_one = true;
}
/* VALADDR points to an integer of LEN bytes.
unsigned char octa1, octa2, octa3, carry;
int cycle;
- /* FIXME: We should be not printing leading zeroes in most cases. */
-
-
/* Octal is 3 bits, which doesn't fit. Yuk. So we have to track
* the extra bits, which cycle every three bytes:
*
carry = 0;
fputs_filtered ("0", stream);
+ bool seen_a_one = false;
if (byte_order == BFD_ENDIAN_BIG)
{
for (p = valaddr;
octa1 = (HIGH_ZERO & *p) >> 5;
octa2 = (LOW_ZERO & *p) >> 2;
carry = (CARRY_ZERO & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
break;
case 1:
octa2 = (MID_ONE & *p) >> 4;
octa3 = (LOW_ONE & *p) >> 1;
carry = (CARRY_ONE & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
case 2:
octa2 = (MID_TWO & *p) >> 3;
octa3 = (LOW_TWO & *p);
carry = 0;
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
default:
octa1 = (HIGH_ZERO & *p) >> 5;
octa2 = (LOW_ZERO & *p) >> 2;
carry = (CARRY_ZERO & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
break;
case 1:
octa2 = (MID_ONE & *p) >> 4;
octa3 = (LOW_ONE & *p) >> 1;
carry = (CARRY_ONE & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
case 2:
octa2 = (MID_TWO & *p) >> 3;
octa3 = (LOW_TWO & *p);
carry = 0;
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
default:
#define HIGH_NIBBLE( x ) (((x) & 0x0F0) >> 4)
const gdb_byte *p;
- unsigned char *digits;
int carry;
int decimal_len;
int i, j, decimal_digits;
as the base 16 number, which is 2 digits per byte. */
decimal_len = len * 2 * 2;
- digits = (unsigned char *) xmalloc (decimal_len);
-
- for (i = 0; i < decimal_len; i++)
- {
- digits[i] = 0;
- }
+ std::vector<unsigned char> digits (decimal_len, 0);
/* Ok, we have an unknown number of bytes of data to be printed in
* decimal.
/* Ok, now "digits" is the decimal representation, with
the "decimal_digits" actual digits. Print! */
- for (i = decimal_digits - 1; i >= 0; i--)
+ for (i = decimal_digits - 1; i > 0 && digits[i] == 0; --i)
+ ;
+
+ for (; i >= 0; i--)
{
fprintf_filtered (stream, "%1d", digits[i]);
}
- xfree (digits);
}
/* VALADDR points to an integer of LEN bytes. Print it in hex on stream. */
void
print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
- unsigned len, enum bfd_endian byte_order)
+ unsigned len, enum bfd_endian byte_order,
+ bool zero_pad)
{
const gdb_byte *p;
- /* FIXME: We should be not printing leading zeroes in most cases. */
-
fputs_filtered ("0x", stream);
if (byte_order == BFD_ENDIAN_BIG)
{
- for (p = valaddr;
+ p = valaddr;
+
+ if (!zero_pad)
+ {
+ /* Strip leading 0 bytes, but be sure to leave at least a
+ single byte at the end. */
+ for (; p < valaddr + len - 1 && !*p; ++p)
+ ;
+ }
+
+ const gdb_byte *first = p;
+ for (;
p < valaddr + len;
p++)
{
- fprintf_filtered (stream, "%02x", *p);
+ /* When not zero-padding, use a different format for the
+ very first byte printed. */
+ if (!zero_pad && p == first)
+ fprintf_filtered (stream, "%x", *p);
+ else
+ fprintf_filtered (stream, "%02x", *p);
}
}
else
{
- for (p = valaddr + len - 1;
+ p = valaddr + len - 1;
+
+ if (!zero_pad)
+ {
+ /* Strip leading 0 bytes, but be sure to leave at least a
+ single byte at the end. */
+ for (; p >= valaddr + 1 && !*p; --p)
+ ;
+ }
+
+ const gdb_byte *first = p;
+ for (;
p >= valaddr;
p--)
{
- fprintf_filtered (stream, "%02x", *p);
+ /* When not zero-padding, use a different format for the
+ very first byte printed. */
+ if (!zero_pad && p == first)
+ fprintf_filtered (stream, "%x", *p);
+ else
+ fprintf_filtered (stream, "%02x", *p);
}
}
}
struct ui_file *);
extern void print_binary_chars (struct ui_file *, const gdb_byte *,
- unsigned int, enum bfd_endian);
+ unsigned int, enum bfd_endian, bool);
extern void print_octal_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian);
unsigned int, enum bfd_endian);
extern void print_hex_chars (struct ui_file *, const gdb_byte *,
- unsigned int, enum bfd_endian);
+ unsigned int, enum bfd_endian, bool);
extern void print_char_chars (struct ui_file *, struct type *,
const gdb_byte *, unsigned int, enum bfd_endian);