aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-07-12 17:33:15 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-07-12 17:33:15 +0000
commitadd265ae415ecd40208537d1f84155f868668ef5 (patch)
tree5a6c5c581d651b42b9416e2c2eaf149b80bb7ffd
parent953ac07ed78d7fa016fe4ef551afc513700aa393 (diff)
downloadfsf-binutils-gdb-add265ae415ecd40208537d1f84155f868668ef5.zip
fsf-binutils-gdb-add265ae415ecd40208537d1f84155f868668ef5.tar.gz
fsf-binutils-gdb-add265ae415ecd40208537d1f84155f868668ef5.tar.bz2
Add is_ilp32_target/is_lp64_target.
2010-07-12 Ulrich Weigand <uweigand@de.ibm.com> H.J. Lu <hongjiu.lu@intel.com> * lib/gdb.exp (is_ilp32_target): New. (is_lp64_target): Likewise. * gdb.arch/amd64-byte.exp: Use is_lp64_target to check 64bit target. * gdb.arch/amd64-disp-step.exp: Likewise. * gdb.arch/amd64-dword.exp: Likewise. * gdb.arch/amd64-i386-address.exp: Likewise. * gdb.arch/amd64-word.exp: Likewise. * gdb.arch/i386-avx.exp: Use is_ilp32_target to check for 32bit target. * gdb.arch/i386-bp_permanent.exp: Likewise. * gdb.arch/i386-byte.exp: Likewise. * gdb.arch/i386-disp-step.exp: Likewise. * gdb.arch/i386-gnu-cfi.exp: Likewise. * gdb.arch/i386-prologue.exp: Likewise. * gdb.arch/i386-size-overlap.exp: Likewise. * gdb.arch/i386-size.exp: Likewise. * gdb.arch/i386-sse.exp: Likewise. * gdb.arch/i386-unwind.exp: Likewise. * gdb.arch/i386-word.exp: Likewise. * gdb.arch/ppc64-atomic-inst.exp: Use is_lp64_target to execute test only when building 64-bit executables. Do not hard-code -m64 option.
-rw-r--r--gdb/testsuite/ChangeLog30
-rw-r--r--gdb/testsuite/gdb.arch/amd64-byte.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-dword.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-i386-address.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-word.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-avx.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-bp_permanent.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-byte.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-gnu-cfi.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-size-overlap.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-size.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-unwind.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-word.exp2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp6
-rw-r--r--gdb/testsuite/lib/gdb.exp77
19 files changed, 126 insertions, 19 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5d29407..803e74d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,33 @@
+2010-07-12 Ulrich Weigand <uweigand@de.ibm.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * lib/gdb.exp (is_ilp32_target): New.
+ (is_lp64_target): Likewise.
+
+ * gdb.arch/amd64-byte.exp: Use is_lp64_target to check 64bit
+ target.
+ * gdb.arch/amd64-disp-step.exp: Likewise.
+ * gdb.arch/amd64-dword.exp: Likewise.
+ * gdb.arch/amd64-i386-address.exp: Likewise.
+ * gdb.arch/amd64-word.exp: Likewise.
+
+ * gdb.arch/i386-avx.exp: Use is_ilp32_target to check for 32bit
+ target.
+ * gdb.arch/i386-bp_permanent.exp: Likewise.
+ * gdb.arch/i386-byte.exp: Likewise.
+ * gdb.arch/i386-disp-step.exp: Likewise.
+ * gdb.arch/i386-gnu-cfi.exp: Likewise.
+ * gdb.arch/i386-prologue.exp: Likewise.
+ * gdb.arch/i386-size-overlap.exp: Likewise.
+ * gdb.arch/i386-size.exp: Likewise.
+ * gdb.arch/i386-sse.exp: Likewise.
+ * gdb.arch/i386-unwind.exp: Likewise.
+ * gdb.arch/i386-word.exp: Likewise.
+
+ * gdb.arch/ppc64-atomic-inst.exp: Use is_lp64_target to execute
+ test only when building 64-bit executables. Do not hard-code
+ -m64 option.
+
2010-07-07 Doug Evans <dje@google.com>
* lib/gdb.exp (gdb_test_list_exact): New function.
diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp
index 53d1c54..09b7053 100644
--- a/gdb/testsuite/gdb.arch/amd64-byte.exp
+++ b/gdb/testsuite/gdb.arch/amd64-byte.exp
@@ -23,7 +23,7 @@ if $tracelevel {
}
-if { ![istarget x86_64-*-* ] } {
+if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
verbose "Skipping amd64 byte register tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
index d77f024..f25093f 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
@@ -22,7 +22,7 @@ if $tracelevel {
}
-if ![istarget "x86_64-*-linux*"] then {
+if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
verbose "Skipping x86_64 displaced stepping tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/amd64-dword.exp b/gdb/testsuite/gdb.arch/amd64-dword.exp
index 4d0a6b7..3719b58 100644
--- a/gdb/testsuite/gdb.arch/amd64-dword.exp
+++ b/gdb/testsuite/gdb.arch/amd64-dword.exp
@@ -23,7 +23,7 @@ if $tracelevel {
}
-if { ![istarget x86_64-*-* ] } {
+if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
verbose "Skipping amd64 dword register tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.exp b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
index e98c254..829d9a2 100644
--- a/gdb/testsuite/gdb.arch/amd64-i386-address.exp
+++ b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
@@ -18,7 +18,7 @@
# Test UNsigned extension of the 32-bit inferior address on a 64-bit host.
# On native 32-bit host the test always PASSed.
-if {![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]} then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_lp64_target] } then {
verbose "Skipping amd64->i386 adress test."
return
}
diff --git a/gdb/testsuite/gdb.arch/amd64-word.exp b/gdb/testsuite/gdb.arch/amd64-word.exp
index 04448d7..031f153 100644
--- a/gdb/testsuite/gdb.arch/amd64-word.exp
+++ b/gdb/testsuite/gdb.arch/amd64-word.exp
@@ -23,7 +23,7 @@ if $tracelevel {
}
-if { ![istarget x86_64-*-* ] } {
+if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
verbose "Skipping amd64 word register tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp
index 426e9d3..7bf748f 100644
--- a/gdb/testsuite/gdb.arch/i386-avx.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx.exp
@@ -77,7 +77,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
"set first breakpoint in main"
gdb_continue_to_breakpoint "continue to first breakpoint in main"
-if [istarget i?86-*-*] {
+if [is_ilp32_target] {
set nr_regs 8
} else {
set nr_regs 16
diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
index a8eb669..a312db1 100644
--- a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
+++ b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
@@ -22,7 +22,7 @@ if $tracelevel {
# Test stepping over permanent breakpoints on i386.
-if ![istarget "i?86-*-*"] then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping skip over permanent breakpoint on i386 tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp
index d4dd5a5..4a17ed0 100644
--- a/gdb/testsuite/gdb.arch/i386-byte.exp
+++ b/gdb/testsuite/gdb.arch/i386-byte.exp
@@ -23,7 +23,7 @@ if $tracelevel {
}
-if { ![istarget i?86-*-*] } {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping i386 byte register tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step.exp b/gdb/testsuite/gdb.arch/i386-disp-step.exp
index 41f39cf..298973c 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/i386-disp-step.exp
@@ -22,7 +22,7 @@ if $tracelevel {
}
-if ![istarget "i?86-*-linux*"] then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping x86 displaced stepping tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp b/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
index fac9e11..4ad4902 100644
--- a/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
+++ b/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
@@ -27,7 +27,7 @@ if $tracelevel {
# Test i386 unwinder.
-if ![istarget "i?86-*-*"] then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping i386 unwinder tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.exp b/gdb/testsuite/gdb.arch/i386-prologue.exp
index be4b263..6b7b51d 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue.exp
@@ -26,7 +26,7 @@ if $tracelevel {
# Test i386 prologue analyzer.
-if ![istarget "i?86-*-*"] then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping i386 prologue tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-size-overlap.exp b/gdb/testsuite/gdb.arch/i386-size-overlap.exp
index bb78c7a..2f22422 100644
--- a/gdb/testsuite/gdb.arch/i386-size-overlap.exp
+++ b/gdb/testsuite/gdb.arch/i386-size-overlap.exp
@@ -21,7 +21,7 @@ if $tracelevel {
# Test that GDB can handle overlapping sizes of symbols.
-if ![istarget "i?86-*-*"] then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping i386 unwinder tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-size.exp b/gdb/testsuite/gdb.arch/i386-size.exp
index e4d4ad3..6e397f9 100644
--- a/gdb/testsuite/gdb.arch/i386-size.exp
+++ b/gdb/testsuite/gdb.arch/i386-size.exp
@@ -24,7 +24,7 @@ if $tracelevel {
# Test that GDB can see the sizes of symbols.
-if ![istarget "i?86-*-*"] then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping i386 unwinder tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp
index 72a8fb2..cb3af4f 100644
--- a/gdb/testsuite/gdb.arch/i386-sse.exp
+++ b/gdb/testsuite/gdb.arch/i386-sse.exp
@@ -77,7 +77,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
"set first breakpoint in main"
gdb_continue_to_breakpoint "continue to first breakpoint in main"
-if [istarget i?86-*-*] {
+if [is_ilp32_target] {
set nr_regs 8
} else {
set nr_regs 16
diff --git a/gdb/testsuite/gdb.arch/i386-unwind.exp b/gdb/testsuite/gdb.arch/i386-unwind.exp
index ac96683..1c13089 100644
--- a/gdb/testsuite/gdb.arch/i386-unwind.exp
+++ b/gdb/testsuite/gdb.arch/i386-unwind.exp
@@ -25,7 +25,7 @@ if $tracelevel {
# Test i386 unwinder.
-if ![istarget "i?86-*-*"] then {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping i386 unwinder tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/i386-word.exp b/gdb/testsuite/gdb.arch/i386-word.exp
index a178fed..827d101 100644
--- a/gdb/testsuite/gdb.arch/i386-word.exp
+++ b/gdb/testsuite/gdb.arch/i386-word.exp
@@ -23,7 +23,7 @@ if $tracelevel {
}
-if { ![istarget i?86-*-*] } {
+if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
verbose "Skipping i386 word register tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
index c31c280c3..8ae2317 100644
--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
@@ -25,7 +25,7 @@ if $tracelevel {
# instruction.
-if ![istarget "powerpc64-*"] then {
+if {![istarget "powerpc*"] || ![is_lp64_target]} {
verbose "Skipping testing of powerpc64 single stepping over atomic sequences."
return
}
@@ -33,9 +33,9 @@ if ![istarget "powerpc64-*"] then {
set testfile "ppc64-atomic-inst"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-set compile_flags "debug quiet"
+set compile_flags {debug quiet}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat $compile_flags additional_flags=-m64]] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_flags] != "" } {
unsupported "Testcase compile failed."
return -1
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index b5b3362..032c1c6 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1454,6 +1454,83 @@ proc skip_shlib_tests {} {
return 1
}
+# Return 1 if target is ILP32.
+# This cannot be decided simply from looking at the target string,
+# as it might depend on externally passed compiler options like -m64.
+proc is_ilp32_target {} {
+ global is_ilp32_target_saved
+
+ # Use the cached value, if it exists. Cache value per "board" to handle
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
+ set me "is_ilp32_target"
+ set board [target_info name]
+ if [info exists is_ilp32_target_saved($board)] {
+ verbose "$me: returning saved $is_ilp32_target_saved($board)" 2
+ return $is_ilp32_target_saved($board)
+ }
+
+
+ set src ilp32[pid].c
+ set obj ilp32[pid].o
+
+ set f [open $src "w"]
+ puts $f "int dummy\[sizeof (int) == 4"
+ puts $f " && sizeof (void *) == 4"
+ puts $f " && sizeof (long) == 4 ? 1 : -1\];"
+ close $f
+
+ verbose "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $obj object {quiet}]
+ file delete $src
+ file delete $obj
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 0" 2
+ return [set is_ilp32_target_saved($board) 0]
+ }
+
+ verbose "$me: returning 1" 2
+ return [set is_ilp32_target_saved($board) 1]
+}
+
+# Return 1 if target is LP64.
+# This cannot be decided simply from looking at the target string,
+# as it might depend on externally passed compiler options like -m64.
+proc is_lp64_target {} {
+ global is_lp64_target_saved
+
+ # Use the cached value, if it exists. Cache value per "board" to handle
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
+ set me "is_lp64_target"
+ set board [target_info name]
+ if [info exists is_lp64_target_saved($board)] {
+ verbose "$me: returning saved $is_lp64_target_saved($board)" 2
+ return $is_lp64_target_saved($board)
+ }
+
+ set src lp64[pid].c
+ set obj lp64[pid].o
+
+ set f [open $src "w"]
+ puts $f "int dummy\[sizeof (int) == 4"
+ puts $f " && sizeof (void *) == 8"
+ puts $f " && sizeof (long) == 8 ? 1 : -1\];"
+ close $f
+
+ verbose "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $obj object {quiet}]
+ file delete $src
+ file delete $obj
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 0" 2
+ return [set is_lp64_target_saved($board) 0]
+ }
+
+ verbose "$me: returning 1" 2
+ return [set is_lp64_target_saved($board) 1]
+}
+
# Run a test on the target to see if it supports vmx hardware. Return 0 if so,
# 1 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.