binutils-all/objdump.exp: handle "powerpc" cpu
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / objdump.exp
1 # Copyright (C) 1993, 1994 Free Software Foundation, Inc.
2
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 2 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.
12 #
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
19
20 # This file was written by Rob Savoye <rob@cygnus.com>
21 # and rewritten by Ian Lance Taylor <ian@cygnus.com>
22
23 if {[which $OBJDUMP] == 0} then {
24 perror "$OBJDUMP does not exist"
25 return
26 }
27
28 send_user "Version [binutil_version $OBJDUMP]"
29
30 # Simple test of objdump -i
31
32 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"]
33
34 set cpus_expected "(a29k|alliant|alpha|arm|convex|h8|hppa|i386|i860|i960|m68k|m88k|mips|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k)"
35
36 set want "BFD header file version.*srec.*header .* endian, data .* endian.*$cpus_expected"
37
38 if [regexp $want $got] then {
39 pass "objdump -i"
40 } else {
41 fail "objdump -i"
42 }
43
44 # The remaining tests require a test file.
45
46 if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
47 return
48 }
49
50 # Test objdump -f
51
52 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f tmpdir/bintest.o"]
53
54 set want "tmpdir/bintest.o:\[ \]*file format.*architecture:\[ \]*${cpus_expected}.*HAS_RELOC.*HAS_SYMS"
55
56 if ![regexp $want $got] then {
57 fail "objdump -f"
58 } else {
59 pass "objdump -f"
60 }
61
62 # Test objdump -h
63
64 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/bintest.o"]
65
66 set want "tmpdir/bintest.o:\[ \]*file format.*SECTION\[ ]*\[0-9\]+\[ \]*\\\[\[^\]\]*(text|TEXT)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*.*SECTION\[ \]*\[0-9\]+\[ \]*\\\[\[^\]\]*(data|DATA)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*"
67
68 if ![regexp $want $got all text_name text_size data_name data_size] then {
69 fail "objdump -h"
70 } else {
71 verbose "text size is $text_size"
72 verbose "data size is $data_size"
73 if {$text_size < 8 || $data_size < 4} then {
74 fail "objdump -h (sizes too small)"
75 } else {
76 pass "objdump -h"
77 }
78 }
79
80 # Test objdump -t
81
82 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t tmpdir/bintest.o"]
83
84 if [info exists vars] then { unset vars }
85 while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} {
86 set vars($symbol) 1
87 set got $rest
88 }
89
90 if {![info exists vars(text_symbol)] \
91 || ![info exists vars(data_symbol)] \
92 || ![info exists vars(common_symbol)] \
93 || ![info exists vars(external_symbol)]} then {
94 fail "objdump -t"
95 } else {
96 pass "objdump -t"
97 }
98
99 # Test objdump -r
100
101 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r tmpdir/bintest.o"]
102
103 set want "tmpdir/bintest.o:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT)\[^\]\]*\\\].*external_symbol"
104
105 if [regexp $want $got] then {
106 pass "objdump -r"
107 } else {
108 fail "objdump -r"
109 }
110
111 # Test objdump -s
112
113 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s tmpdir/bintest.o"]
114
115 set want "tmpdir/bintest.o:\[ \]*file format.*Contents.*(text|TEXT)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000)"
116
117 if [regexp $want $got] then {
118 pass "objdump -s"
119 } else {
120 fail "objdump -s"
121 }
122
123 # Options which are not tested: -a -d -D -R -T -x -l --stabs
124 # I don't see any generic way to test any of these other than -a.
125 # Tests could be written for specific targets, and that should be done
126 # if specific problems are found.
This page took 0.039944 seconds and 5 git commands to generate.