1 # Copyright
1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3 # Free Software Foundation
, Inc.
5 # This
program is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
2 of the License
, or
8 #
(at your option
) any later version.
10 # This
program is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this
program; if not
, write to the Free Software
17 # Foundation
, Inc.
, 51 Franklin Street
- Fifth Floor
, Boston
, MA
02110-1301, USA.
19 # Please email
any bugs
, comments
, and
/or additions to this file to
:
20 # bug
-dejagnu@prep.ai.mit.edu
22 # This file was written by Rob Savoye
<rob@cygnus.com
>
23 # and rewritten by Ian Lance Taylor
<ian@cygnus.com
>
25 if ![is_remote host
] {
26 if {[which $OBJDUMP
] == 0} then {
27 perror
"$OBJDUMP does not exist"
32 send_user
"Version [binutil_version $OBJDUMP]"
34 # Simple test of objdump
-i
36 set got
[binutils_run $OBJDUMP
"$OBJDUMPFLAGS -i"]
38 set cpus_expected
[list
]
39 lappend cpus_expected alpha arc arm cris
40 lappend cpus_expected d10v d30v fr30 fr500 fr550 h8 hppa i386 i860 i960 ip2022
41 lappend cpus_expected m32r m68hc11 m68hc12 m68k m88k MCore
42 lappend cpus_expected mips mn10200 mn10300 msp ns32k pj powerpc pyramid
43 lappend cpus_expected romp rs6000 s390 sh sparc
44 lappend cpus_expected tahoe tic54x tic80 tms320c30 tms320c4x tms320c54x v850
45 lappend cpus_expected vax we32k x86
-64 xscale z8k z8001 z8002
47 # Make sure the target CPU shows up in the list.
48 lappend cpus_expected $
{target_cpu
}
51 set cpus_regex
"([join $cpus_expected | ])"
53 verbose
-log "CPU regex: $cpus_regex"
55 set want
"BFD header file version.*srec\[^\n\]*\n\[^\n\]*header \[^\n\]*endian\[^\n\]*, data \[^\n\]*endian.*$cpus_regex"
57 if [regexp $want $got
] then {
63 # The remaining tests require a test file.
66 if {![binutils_assemble $srcdir
/$subdir
/bintest.s tmpdir
/bintest.o
]} then {
70 set testfile
[remote_download host tmpdir
/bintest.o
]
72 set testfile tmpdir
/bintest.o
77 set got
[binutils_run $OBJDUMP
"$OBJDUMPFLAGS -f $testfile"]
79 set want
"$testfile:\[ \]*file format.*architecture:\[ \]*${cpus_regex}.*HAS_RELOC.*HAS_SYMS"
81 if ![regexp $want $got
] then {
89 set got
[binutils_run $OBJDUMP
"$OBJDUMPFLAGS -h $testfile"]
91 set want
"$testfile:\[ \]*file format.*Sections.*\[0-9\]+\[ \]+\[^ \]*(text|TEXT|\\\$CODE\\\$)\[^ \]*\[ \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[ \]+\[^ \]*(\\.data|DATA)\[^ \]*\[ \]*(\[0-9a-fA-F\]+)"
93 if ![regexp $want $got all text_name text_size data_name data_size
] then {
96 verbose
"text name is $text_name size is $text_size"
97 verbose
"data name is $data_name size is $data_size"
100 # The
[ti
]c4x target has the
property sizeof
(char
)=sizeof
(long
)=1
101 if [istarget
*c4x
*-*-*] then {
105 # c54x section sizes are in bytes
, not octets
; adjust accordingly
106 if [istarget
*c54x
*-*-*] then {
110 if {[expr
"0x$text_size"] < $ets || [expr "0x$data_size"] < $eds} then {
111 send_log
"sizes too small\n"
120 set got
[binutils_run $OBJDUMP
"$OBJDUMPFLAGS -t $testfile"]
122 if [info exists vars
] then { unset vars
}
123 while {[regexp
"(\[a-z\]*_symbol)(.*)" $got all symbol rest]} {
128 if {![info exists vars
(text_symbol
)] \
129 ||
![info exists vars
(data_symbol
)] \
130 ||
![info exists vars
(common_symbol
)] \
131 ||
![info exists vars
(external_symbol
)]} then {
139 set got
[binutils_run $OBJDUMP
"$OBJDUMPFLAGS -r $testfile"]
141 set want
"$testfile:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol"
143 if [regexp $want $got
] then {
151 set got
[binutils_run $OBJDUMP
"$OBJDUMPFLAGS -s $testfile"]
153 set want
"$testfile:\[ \]*file format.*Contents.*(text|TEXT|\\\$CODE\\\$)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000|00000100).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000|00000200)"
155 if [regexp $want $got
] then {
161 # Options which are not tested
: -a
-d
-D
-R
-T
-x
-l
--stabs
162 # I don
't see any generic way to test any of these other than -a.
163 # Tests could be written for specific targets, and that should be done
164 # if specific problems are found.