summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/long_long.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/long_long.exp')
-rw-r--r--gdb/testsuite/gdb.base/long_long.exp66
1 files changed, 57 insertions, 9 deletions
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index b779434d2ee..651daffc986 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -69,6 +69,28 @@ gdb_expect {
default { fail "(timeout) getting target endian" }
}
+# Detect targets with 2-byte integers. Yes, it's not general to assume
+# that all others have 4-byte ints, but don't worry about it until one
+# actually exists.
+
+set sizeof_int 4
+send_gdb "print sizeof(int)\n"
+gdb_expect {
+ -re ".* = 2.*$gdb_prompt $" { set sizeof_int 2 }
+ -re ".*$gdb_prompt $" { }
+ default { }
+}
+
+# Detect targets with 4-byte doubles.
+
+set sizeof_double 8
+send_gdb "print sizeof(double)\n"
+gdb_expect {
+ -re ".* = 4.*$gdb_prompt $" { set sizeof_double 4 }
+ -re ".*$gdb_prompt $" { }
+ default { }
+}
+
gdb_test "n 4" ".*38.*" "get to known place"
# Check the hack for long long prints.
@@ -96,17 +118,39 @@ gdb_test "p/o oct" ".*.*"
gdb_test "p/t oct" ".*1010011100101110111001010011100101110111000001010011100101110111.*"
gdb_test "p/a oct" ".*0x.*77053977.*"
gdb_test "p/c oct" ".*'w'.*"
-gdb_test "p/f oct" ".*-5.9822653797615723e-120.*"
+
+if { $sizeof_double == 8 } {
+
+ gdb_test "p/f oct" ".*-5.9822653797615723e-120.*"
+
+} else {
+
+ gdb_test "p/f oct" ".*-2.42716126e-15.*"
+}
if { $target_bigendian_p } {
- gdb_test "p/d *(int *)&oct" ".*-1490098887.*"
- gdb_test "p/u *(int *)&oct" ".*2804868409.*"
- gdb_test "p/o *(int *)&oct" ".*024713562471.*"
- gdb_test "p/t *(int *)&oct" ".*10100111001011101110010100111001.*"
- gdb_test "p/a *(int *)&oct" ".*0xf*a72ee539.*"
- gdb_test "p/c *(int *)&oct" ".*57 '9'.*"
- gdb_test "p/f *(int *)&oct" ".*-2.42716126e-15.*"
+ if { $sizeof_int == 4 } {
+
+ gdb_test "p/d *(int *)&oct" ".*-1490098887.*"
+ gdb_test "p/u *(int *)&oct" ".*2804868409.*"
+ gdb_test "p/o *(int *)&oct" ".*024713562471.*"
+ gdb_test "p/t *(int *)&oct" ".*10100111001011101110010100111001.*"
+ gdb_test "p/a *(int *)&oct" ".*0xf*a72ee539.*"
+ gdb_test "p/c *(int *)&oct" ".*57 '9'.*"
+ gdb_test "p/f *(int *)&oct" ".*-2.42716126e-15.*"
+
+ } else {
+
+ gdb_test "p/d *(int *)&oct" ".*-22738.*"
+ gdb_test "p/u *(int *)&oct" ".*42798.*"
+ gdb_test "p/o *(int *)&oct" ".*0123456.*"
+ gdb_test "p/t *(int *)&oct" ".*1010011100101110.*"
+ gdb_test "p/a *(int *)&oct" ".*0xffffa72e.*"
+ gdb_test "p/c *(int *)&oct" ".*46 '.'.*"
+ gdb_test "p/f *(int *)&oct" ".*-22738.*"
+
+ }
gdb_test "p/d *(short *)&oct" ".*-22738.*"
gdb_test "p/u *(short *)&oct" ".*42798.*"
@@ -126,7 +170,11 @@ if { $target_bigendian_p } {
gdb_test "x/c &oct" ".*-89 .*"
# FIXME GDB's output is correct, but this longer match fails.
# gdb_test "x/c &oct" ".*-89 '\\\\247'.*"
- gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*"
+ if { $sizeof_double == 8 } {
+ gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*"
+ } else {
+ gdb_test "x/f &oct" ".*-2.42716126e-15.*"
+ }
# FIXME Fill in the results for all the following tests. (But be careful
# about looking at locations with unspecified contents!)