New proc is_aarch32_target
authorYao Qi <yao.qi@linaro.org>
Tue, 7 Jul 2015 15:58:19 +0000 (16:58 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 7 Jul 2015 15:58:19 +0000 (16:58 +0100)
GDB tests running on arm target should be also run on aarch32
(32-bit mode on aarch64).  There should be no difference.  It is not
precise to check target triplet to decide which tests should be run,
because if I compiler all the test binary in 32-bit (arm program),
but target triplet is still aarch64, so that these arm specific tests
are skipped.

This patch is to add a new proc is_aarch32_target which return true
if target triplet is arm or the test binary is compiled for arm.

gdb/testsuite:

2015-07-07  Yao Qi  <yao.qi@linaro.org>

* lib/gdb.exp (is_aarch32_target): New proc.
* gdb.arch/arm-bl-branch-dest.exp: Check is_aarch32_target
instead of "istarget "arm*-*-*"".
* gdb.arch/arm-disp-step.exp: Likewise.
* gdb.arch/thumb-bx-pc.exp: Likewise.
* gdb.arch/thumb-prologue.exp: Likewise.
* gdb.arch/thumb-singlestep.exp: Likewise.
* gdb.base/disp-step-syscall.exp: Likewise.
* gdb.base/float.exp: Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/arm-bl-branch-dest.exp
gdb/testsuite/gdb.arch/arm-disp-step.exp
gdb/testsuite/gdb.arch/thumb-bx-pc.exp
gdb/testsuite/gdb.arch/thumb-prologue.exp
gdb/testsuite/gdb.arch/thumb-singlestep.exp
gdb/testsuite/gdb.base/disp-step-syscall.exp
gdb/testsuite/gdb.base/float.exp
gdb/testsuite/lib/gdb.exp

index 6009cdbe76cce2e15311904331727e1407da9ef3..11f6424c9814ecaedfc28236151d5ac9ff534049 100644 (file)
@@ -1,3 +1,15 @@
+2015-07-07  Yao Qi  <yao.qi@linaro.org>
+
+       * lib/gdb.exp (is_aarch32_target): New proc.
+       * gdb.arch/arm-bl-branch-dest.exp: Check is_aarch32_target
+       instead of "istarget "arm*-*-*"".
+       * gdb.arch/arm-disp-step.exp: Likewise.
+       * gdb.arch/thumb-bx-pc.exp: Likewise.
+       * gdb.arch/thumb-prologue.exp: Likewise.
+       * gdb.arch/thumb-singlestep.exp: Likewise.
+       * gdb.base/disp-step-syscall.exp: Likewise.
+       * gdb.base/float.exp: Likewise.
+
 2015-07-07  Yao Qi  <yao.qi@linaro.org>
 
        * gdb.base/catch-syscall.exp (test_catch_syscall_multi_arch):
index 9a640549fcc334fc4d3c5e57426fd34d2f60568a..f35548afcb4dcfb7dc642f4e8dec835ad6f36e6a 100644 (file)
@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if { ![istarget "arm*-*-*"] } {
+if { ![is_aarch32_target] } {
     verbose "Skipping ${gdb_test_file_name}."
     return
 }
index e191f73da53a32ad14305e9637d38b703c8cdcbc..83858ca356124bd105f3a072447569699d7a25be 100644 (file)
@@ -17,7 +17,7 @@
 
 # Test arm displaced stepping.
 
-if {![istarget "arm*-*-*"]} then {
+if {![is_aarch32_target]} then {
     verbose "Skipping arm displaced stepping tests."
     return
 }
index f4023390c9b401cb35be81a4b92375ac902104ea..05be0e172b6ea56ae28de06826edb435d15f9ef2 100644 (file)
@@ -15,7 +15,7 @@
 
 # Test PC adjustment from Thumb-mode "bx pc" instruction.
 
-if {![istarget arm*-*]} then {
+if {![is_aarch32_target]} then {
     verbose "Skipping ARM tests."
     return
 }
index 8e3d293b19497636bcafbb275862c8dbb5095a7b..a34beb259803df1492a258179c3bccd5af0f30b4 100644 (file)
@@ -15,7 +15,7 @@
 
 # Test ARM/Thumb prologue analyzer.
 
-if {![istarget arm*-*]} then {
+if {![is_aarch32_target]} then {
     verbose "Skipping ARM prologue tests."
     return
 }
index e7a865f263658d28521bd416d2c2c46c97136eb6..b1d2eb3dd3b503aaca77f197f01d30834d5b7174 100644 (file)
@@ -15,7 +15,7 @@
 
 # Test single-stepping into incorrectly marked Thumb routine
 
-if {![istarget arm*-*]} then {
+if {![is_aarch32_target]} then {
     verbose "Skipping ARM tests."
     return
 }
index b13dce46d24021d62cf630c3100f2dcf39dcd089..ec3fccc2ffc932d149a44f20698b0de7aa30fea3 100644 (file)
@@ -26,7 +26,7 @@ set syscall_insn ""
 
 if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
     set syscall_insn "\[ \t\](int|syscall|sysenter)\[ \t\]"
-} elseif [istarget "arm*-*-linux*"] {
+} elseif [is_aarch32_target] {
     set syscall_insn "\[ \t\](swi|svc)\[ \t\]"
 } else {
     return -1
index f351795ca7031d1213d65a1f8bf53c3a97bad47c..a7183cfa6d560511385991ec543c127ba5045b1d 100644 (file)
@@ -40,7 +40,7 @@ if { [istarget "aarch64*-*-*"] } then {
     gdb_test "info float" "d0.*d1.*d31.*s0.*s1.*s31.*" "info float"
 } elseif { [istarget "alpha*-*-*"] } then {
     gdb_test "info float" "f0.*" "info float"
-} elseif { [istarget "arm*-*-*"] } then {
+} elseif { [is_aarch32_target] } then {
     gdb_test_multiple "info float" "info float" {
        -re "Software FPU type.*mask:.*flags:.*$gdb_prompt $" {
            pass "info float (FPA)"
index 381297a584aba940ff96663d452f16d0c1f2a897..e8ae08c483ebf7622f2ecd1ee6d6820a07ebb51e 100644 (file)
@@ -2271,6 +2271,43 @@ proc is_x86_like_target {} {
     return [expr [is_ilp32_target] && ![is_amd64_regs_target]]
 }
 
+# Return 1 if this target is an arm or aarch32 on aarch64.
+
+gdb_caching_proc is_aarch32_target {
+    if { [istarget "arm*-*-*"] } {
+       return 1
+    }
+
+    if { ![istarget "aarch64*-*-*"] } {
+       return 0
+    }
+
+    set me "is_aarch32_target"
+
+    set src [standard_temp_file aarch32[pid].s]
+    set obj [standard_temp_file aarch32[pid].o]
+
+    set list {}
+    foreach reg \
+       {r0 r1 r2 r3} {
+           lappend list "\tmov $reg, $reg"
+       }
+    gdb_produce_source $src [join $list \n]
+
+    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 0
+    }
+
+    verbose "$me:  returning 1" 2
+    return 1
+}
+
 # Return 1 if displaced stepping is supported on target, otherwise, return 0.
 proc support_displaced_stepping {} {