diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-09-08 17:40:54 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-09-08 17:40:54 +0000 |
commit | 7f062217672c13050f68eec1a6cd296d7b7f93be (patch) | |
tree | c9081719885b884389ec614fe781f137609dc481 /gdb/testsuite | |
parent | bc587a6bd2e261d0a7645d0f5466379fe44f5f8b (diff) | |
download | gdb-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')
-rw-r--r-- | gdb/testsuite/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/typeddwarf.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/backtrace.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/collection.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/report.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/unavailable.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/while-dyn.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 45 |
8 files changed, 71 insertions, 15 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f130a83..b875a0b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,18 @@ 2011-09-08 Jan Kratochvil <jan.kratochvil@redhat.com> + 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. + +2011-09-08 Jan Kratochvil <jan.kratochvil@redhat.com> + PR breakpoints/12435 * gdb.arch/amd64-prologue-xmm.c: New file. * gdb.arch/amd64-prologue-xmm.exp: New file. diff --git a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp index 36a17e5..ca0db06 100644 --- a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp +++ b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp @@ -22,10 +22,10 @@ if ![dwarf2_support] { return 0 } -# This test can only be run on x86 and amd64 targets. +# This test can only be run on x86 and amd64 targets (and not x32). if { [is_x86_like_target] } { set sfile ${test}.S -} elseif {[istarget "x86_64-*-*"]} { +} elseif {[istarget "x86_64-*-*"] && [is_lp64_target]} { set sfile ${test}-amd64.S } else { return 0 diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp index 9b72d49..e2807c5 100644 --- a/gdb/testsuite/gdb.trace/backtrace.exp +++ b/gdb/testsuite/gdb.trace/backtrace.exp @@ -150,10 +150,10 @@ gdb_trace_setactions "8.6: setup TP to collect regs, args, and locals" \ "$tdp4" \ "collect \$regs, \$args, \$locs" "^$" -if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then { +if [is_amd64_regs_target] { set fpreg "\$rbp" set spreg "\$rsp" -} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then { +} elseif [is_x86_like_target] { set fpreg "\$ebp" set spreg "\$esp" } else { diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp index 4917ea8..4d57ad4 100644 --- a/gdb/testsuite/gdb.trace/collection.exp +++ b/gdb/testsuite/gdb.trace/collection.exp @@ -45,11 +45,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ set ws "\[\r\n\t \]+" set cr "\[\r\n\]+" -if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then { +if [is_amd64_regs_target] { set fpreg "rbp" set spreg "rsp" set pcreg "rip" -} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then { +} elseif [is_x86_like_target] { set fpreg "ebp" set spreg "esp" set pcreg "eip" diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp index 8bb6780..f765a57 100644 --- a/gdb/testsuite/gdb.trace/report.exp +++ b/gdb/testsuite/gdb.trace/report.exp @@ -159,11 +159,11 @@ gdb_trace_setactions "9.x: setup TP to collect locals" \ "$tdp4" \ "collect \$locs" "^$" -if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then { +if [is_amd64_regs_target] { set fpreg "rbp" set spreg "rsp" set pcreg "rip" -} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then { +} elseif [is_x86_like_target] { set fpreg "ebp" set spreg "esp" set pcreg "eip" diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp index fce65ca..7278ebf 100644 --- a/gdb/testsuite/gdb.trace/unavailable.exp +++ b/gdb/testsuite/gdb.trace/unavailable.exp @@ -30,11 +30,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ set ws "\[\r\n\t \]+" set cr "\[\r\n\]+" -if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then { +if [is_amd64_regs_target] { set fpreg "rbp" set spreg "rsp" set pcreg "rip" -} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then { +} elseif [is_x86_like_target] { set fpreg "ebp" set spreg "esp" set pcreg "eip" @@ -295,12 +295,12 @@ proc gdb_unavailable_registers_test { } { # Test reading uncollected pseudo-registers. The set of which # depends on target. - if {$pcreg == "rip"} then { + if [is_amd64_regs_target] { # Check the raw register first. test_register_unavailable "\$rax" test_register_unavailable "\$eax" test_register_unavailable "\$ax" - } elseif {$pcreg == "eip"} then { + } elseif [is_x86_like_target] { # Check the raw register first. test_register_unavailable "\$eax" test_register_unavailable "\$ax" diff --git a/gdb/testsuite/gdb.trace/while-dyn.exp b/gdb/testsuite/gdb.trace/while-dyn.exp index 6227f23..58aa710 100644 --- a/gdb/testsuite/gdb.trace/while-dyn.exp +++ b/gdb/testsuite/gdb.trace/while-dyn.exp @@ -52,9 +52,9 @@ if { ![gdb_target_supports_trace] } then { # test while-stepping dynamically (live target) # -if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then { +if [is_amd64_regs_target] { set fpreg "\$rbp" -} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then { +} elseif [is_x86_like_target] { set fpreg "\$ebp" } else { set fpreg "\$fp" 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. |