aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2001-07-17 22:19:49 +0000
committerStephane Carrez <stcarrez@nerim.fr>2001-07-17 22:19:49 +0000
commit7e5a932280d5d0cd731a09e195c9e7a25c1677d4 (patch)
tree1680e734b21393f5535f3719712ca0128d8cb15c
parentde58f10fe4e62d1beeffed6136eeada972b08719 (diff)
downloadgdb-7e5a932280d5d0cd731a09e195c9e7a25c1677d4.zip
gdb-7e5a932280d5d0cd731a09e195c9e7a25c1677d4.tar.gz
gdb-7e5a932280d5d0cd731a09e195c9e7a25c1677d4.tar.bz2
* gdb.base/long_long.exp: Detect size of pointer. Take into
account 2-byte pointers when testing for p/a results.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/long_long.exp42
2 files changed, 42 insertions, 5 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ad4b806..844e4c0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2001-07-17 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+ * gdb.base/long_long.exp: Detect size of pointer. Take into
+ account 2-byte pointers when testing for p/a results.
+
+2001-07-17 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
* gdb.base/remote.c (RANDOM_DATA_SIZE): New define, defaults to 48K
and defined to 1K for m68hc11.
(random_data): Reduce table to 1K for embedded platforms (68hc11).
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index 69a456b..ff8a1f9 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -85,6 +85,15 @@ gdb_expect {
default { }
}
+# Detect targets with 2-byte pointers. Assume all others use 4-bytes.
+set sizeof_ptr 4
+send_gdb "print sizeof(void*)\n"
+gdb_expect {
+ -re ".* = 2.*$gdb_prompt $" { set sizeof_ptr 2 }
+ -re ".*$gdb_prompt $" { }
+ default { }
+}
+
# Detect targets with 4-byte shorts. Assume all others use 2-bytes.
set sizeof_short 2
@@ -130,7 +139,11 @@ gdb_test "p/d oct" ".*-6399925985474168457.*"
gdb_test "p/u oct" ".*12046818088235383159.*"
gdb_test "p/o oct" ".*.*"
gdb_test "p/t oct" ".*1010011100101110111001010011100101110111000001010011100101110111.*"
-gdb_test "p/a oct" ".*0x.*77053977.*"
+if { $sizeof_ptr == 2 } {
+ gdb_test "p/a oct" ".*0x.*3977.*"
+} else {
+ gdb_test "p/a oct" ".*0x.*77053977.*"
+}
gdb_test "p/c oct" ".*'w'.*"
if { $sizeof_double == 8 } {
@@ -166,7 +179,13 @@ if { $target_bigendian_p } {
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.*"
+
+ if { $sizeof_ptr == 2 } {
+ gdb_test "p/a *(int *)&oct" ".*0xe539.*"
+ } else {
+ 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.*"
@@ -176,7 +195,12 @@ if { $target_bigendian_p } {
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.*"
+
+ if { $sizeof_ptr == 2 } {
+ gdb_test "p/a *(int *)&oct" ".*0xa72e.*"
+ } else {
+ gdb_test "p/a *(int *)&oct" ".*0xffffa72e.*"
+ }
gdb_test "p/c *(int *)&oct" ".*46 '.'.*"
gdb_test "p/f *(int *)&oct" ".*-22738.*"
@@ -187,7 +211,11 @@ if { $target_bigendian_p } {
gdb_test "p/u *(short *)&oct" ".*42798.*"
gdb_test "p/o *(short *)&oct" ".*0123456.*"
gdb_test "p/t *(short *)&oct" ".*1010011100101110.*"
- gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*"
+ if { $sizeof_ptr == 2 } {
+ gdb_test "p/a *(short *)&oct" ".*0xa72e.*"
+ } else {
+ gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*"
+ }
gdb_test "p/c *(short *)&oct" ".* 46 '.'.*"
gdb_test "p/f *(short *)&oct" ".*-22738.*"
} else {
@@ -205,7 +233,11 @@ if { $target_bigendian_p } {
gdb_test "x/u &oct" ".*2804868409.*"
gdb_test "x/o &oct" ".*024713562471.*"
gdb_test "x/t &oct" ".*10100111001011101110010100111001.*"
- gdb_test "x/a &oct" ".*0xa72ee539.*"
+ if { $sizeof_ptr == 2 } {
+ gdb_test "x/a &oct" ".*0xa72e.*"
+ } else {
+ gdb_test "x/a &oct" ".*0xa72ee539.*"
+ }
gdb_test "x/c &oct" ".*-89 .*"
# FIXME GDB's output is correct, but this longer match fails.
# gdb_test "x/c &oct" ".*-89 '\\\\247'.*"