aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-09-08 17:40:54 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-09-08 17:40:54 +0000
commit7f062217672c13050f68eec1a6cd296d7b7f93be (patch)
treec9081719885b884389ec614fe781f137609dc481 /gdb/testsuite/lib
parentbc587a6bd2e261d0a7645d0f5466379fe44f5f8b (diff)
downloadgdb-7f062217672c13050f68eec1a6cd296d7b7f93be.zip
gdb-7f062217672c13050f68eec1a6cd296d7b7f93be.tar.gz
gdb-7f062217672c13050f68eec1a6cd296d7b7f93be.tar.bz2
gdb/testsuite/
Fix compatibility with x32 arch. * testsuite/gdb.dwarf2/typeddwarf.exp: Check also is_lp64_target. * testsuite/gdb.trace/backtrace.exp: Use is_amd64_regs_target and is_x86_like_target. * testsuite/gdb.trace/collection.exp: Likewise. * testsuite/gdb.trace/report.exp: Likewise. * testsuite/gdb.trace/unavailable.exp: Likewise. * testsuite/gdb.trace/while-dyn.exp: Likewise. * testsuite/lib/gdb.exp (is_amd64_regs_target): New function. (is_x86_like_target): Check also is_amd64_regs_target.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp45
1 files changed, 44 insertions, 1 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ef5ad5c..b22e322 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1604,6 +1604,49 @@ proc is_lp64_target {} {
return [set is_lp64_target_saved($board) 1]
}
+# Return 1 if target has x86_64 registers - either amd64 or x32.
+# x32 target identifies as x86_64-*-linux*, therefore it cannot be determined
+# just from the target string.
+proc is_amd64_regs_target {} {
+ global is_amd64_regs_target_saved
+
+ if {![istarget "x86_64-*-*"]} {
+ return 0
+ }
+
+ # 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_amd64_regs_target"
+ set board [target_info name]
+ if [info exists is_amd64_regs_target_saved($board)] {
+ verbose "$me: returning saved $is_amd64_regs_target_saved($board)" 2
+ return $is_amd64_regs_target_saved($board)
+ }
+
+ set src reg64[pid].s
+ set obj reg64[pid].o
+
+ set f [open $src "w"]
+ foreach reg \
+ {rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15} {
+ puts $f "\tincq %$reg"
+ }
+ 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_amd64_regs_target_saved($board) 0]
+ }
+
+ verbose "$me: returning 1" 2
+ return [set is_amd64_regs_target_saved($board) 1]
+}
+
# Return 1 if this target is an x86 or x86-64 with -m32.
proc is_x86_like_target {} {
if {[istarget i?86-*]} {
@@ -1612,7 +1655,7 @@ proc is_x86_like_target {} {
if {![istarget "x86_64-*-*"]} {
return 0
}
- return [is_ilp32_target]
+ return [expr [is_ilp32_target] && ![is_amd64_regs_target]]
}
# Return 1 if displaced stepping is supported on target, otherwise, return 0.