Default to enabling colored disassembly if output is to a terminal.
[binutils-gdb.git] / binutils / testsuite / binutils-all / arm / objdump.exp
blob9cd057e60f1e181a6cc6dd8f2c151b101da4899d
1 # Copyright (C) 2004-2022 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17 if {![istarget "arm*-*-*"]} then {
18 return
21 if {![is_remote host] && [which $OBJDUMP] == 0} then {
22 perror "$OBJDUMP does not exist"
23 return
26 send_user "Version [binutil_version $OBJDUMP]"
28 ###########################
29 # Set up the test of movem.s
30 ###########################
32 if {![binutils_assemble $srcdir/$subdir/thumb2-cond.s tmpdir/thumb2-cond.o]} then {
33 fail "thumb2-cond (assembling)"
34 } else {
36 if [is_remote host] {
37 set objfile [remote_download host tmpdir/thumb2-cond.o]
38 } else {
39 set objfile tmpdir/thumb2-cond.o
42 # Make sure that conditional instructions are correctly decoded.
44 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --disassembler-color=off --start-address=6 $objfile"]
46 set want "bcc.w\[ \t\]*e12.*bx\[ \t\]*lr"
48 if [regexp $want $got] then {
49 pass "thumb2-cond test1"
50 } else {
51 fail "thumb2-cond test1"
54 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=10 $objfile"]
56 set want "bx\[ \t\]*lr"
58 if [regexp $want $got] then {
59 pass "thumb2-cond test2"
60 } else {
61 fail "thumb2-cond test2"
65 ###########################
66 # Set up the test of multiple disassemblies
67 ###########################
69 if {![binutils_assemble $srcdir/$subdir/simple.s tmpdir/simple.o]} then {
70 fail "multiple input files"
71 } else {
73 if [is_remote host] {
74 set objfile [remote_download host tmpdir/simple.o]
75 } else {
76 set objfile tmpdir/simple.o
79 # Make sure multiple disassemblies come out the same
81 set got [binutils_run $OBJDUMP "-dr $objfile $objfile"]
83 set want "$objfile:\[ \]*file format.*$objfile:\[ \]*file format.*push.*add.*sub.*str.*add.*ldmfd"
85 if [regexp $want $got] then {
86 pass "multiple input files"
87 } else {
88 fail "multiple input files"
92 if {![binutils_assemble $srcdir/$subdir/rvct_symbol.s tmpdir/rvct_symbol.o]} then {
93 fail "skip rvct symbol"
94 } else {
96 if [is_remote host] {
97 set objfile [remote_download host tmpdir/rvct_symbol.o]
98 } else {
99 set objfile tmpdir/rvct_symbol.o
102 # Make sure multiple disassemblies come out the same
104 set got [binutils_run $OBJDUMP "-D $objfile $objfile"]
106 set want "foo.*global_a.*global_b"
108 if [regexp $want $got] then {
109 pass "skip rvct symbol"
110 } else {
111 fail "skip rvct symbol"
115 ###########################
116 # Set up generic test framework
117 ###########################
119 set tempfile tmpdir/armtemp.o
120 set copyfile tmpdir/armcopy
122 set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
123 foreach t $test_list {
124 # We need to strip the ".d", but can leave the dirname.
125 verbose [file rootname $t]
126 run_dump_test [file rootname $t]