Home | History | Annotate | Download | only in tests
      1 #! /bin/sh
      2 # Copyright (C) 2007, 2008 Red Hat, Inc.
      3 # This file is part of elfutils.
      4 #
      5 # This file 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 3 of the License, or
      8 # (at your option) any later version.
      9 #
     10 # elfutils is distributed in the hope that it will be useful, but
     11 # 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.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18 . $srcdir/test-subr.sh
     19 
     20 testfiles testfile34 testfile38 testfile41 testfile49
     21 
     22 testrun_compare ${abs_top_builddir}/src/addr2line -f -e testfile34 \
     23 				 0x08048074 0x08048075 0x08048076 \
     24 				 0x08049078 0x08048080 0x08049080 <<\EOF
     25 foo
     26 ??:0
     27 bar
     28 ??:0
     29 _etext
     30 ??:0
     31 data1
     32 ??:0
     33 ??
     34 ??:0
     35 _end
     36 ??:0
     37 EOF
     38 
     39 testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile38 0x02 0x10a 0x211 0x31a <<\EOF
     40 t1_global_outer+0x2
     41 ??:0
     42 t2_global_symbol+0x2
     43 ??:0
     44 t3_global_after_0+0x1
     45 ??:0
     46 (.text)+0x31a
     47 ??:0
     48 EOF
     49 
     50 testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile41 0x1 0x104 <<\EOF
     51 small_global_at_large_global+0x1
     52 ??:0
     53 small_global_first_at_large_global+0x1
     54 ??:0
     55 EOF
     56 
     57 testfiles testfile12 testfile14
     58 tempfiles testmaps
     59 
     60 cat > testmaps <<EOF
     61 00400000-00401000 r-xp 00000000 fd:01 4006812                            `pwd`/testfile14
     62 00500000-00501000 rw-p 00000000 fd:01 4006812                            `pwd`/testfile14
     63 01000000-01001000 r-xp 00000000 fd:01 1234567				 `pwd`/testfile12
     64 01100000-01011000 rw-p 00000000 fd:01 1234567				 `pwd`/testfile12
     65 2aaaaaaab000-2aaaaaaad000 rw-p 2aaaaaaab000 00:00 0 
     66 2aaaaaae2000-2aaaaaae3000 rw-p 2aaaaaae2000 00:00 0 
     67 7fff61068000-7fff6107d000 rw-p 7ffffffea000 00:00 0                      [stack]
     68 7fff611fe000-7fff61200000 r-xp 7fff611fe000 00:00 0                      [vdso]
     69 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
     70 EOF
     71 
     72 testrun_compare ${abs_top_builddir}/src/addr2line -S -M testmaps 0x40047c 0x10009db <<\EOF
     73 caller+0x14
     74 /home/drepper/local/elfutils-build/20050425/v.c:11
     75 foo+0xb
     76 /home/drepper/local/elfutils-build/20030710/u.c:5
     77 EOF
     78 
     79 #	.section .text
     80 #	nop #0
     81 #sizeless_foo:
     82 #	nop #1
     83 #	nop #2
     84 #sized_bar:
     85 #	nop #3
     86 #	nop #4
     87 #sizeless_baz:
     88 #	nop #5
     89 #	nop #6
     90 #	.size sized_bar, . - sized_bar
     91 #	nop #7
     92 #	nop #8
     93 #sizeless_x:
     94 #	nop #9
     95 #	.org 0x100
     96 #	nop #0
     97 #	.globl global_outer
     98 #global_outer:
     99 #	nop #1
    100 #	nop #2
    101 #	.globl global_in_global
    102 #global_in_global:
    103 #	nop #3
    104 #	nop #4
    105 #	.size global_in_global, . - global_in_global
    106 #local_in_global:
    107 #	nop #5 
    108 #	nop #6 
    109 #	.size local_in_global, . - local_in_global
    110 #	nop #7
    111 #	nop #8
    112 #.Lsizeless1:
    113 #	nop #9
    114 #	nop #10
    115 #	.size global_outer, . - global_outer
    116 #	nop #11
    117 #	.org 0x200
    118 #	nop #0
    119 #local_outer:
    120 #	nop #1
    121 #	nop #2
    122 #	.globl global_in_local
    123 #global_in_local:
    124 #	nop #3
    125 #	nop #4
    126 #	.size global_in_local, . - global_in_local
    127 #local_in_local:
    128 #	nop #5 
    129 #	nop #6 
    130 #	.size local_in_local, . - local_in_local
    131 #	nop #7
    132 #	nop #8
    133 #.Lsizeless2:
    134 #	nop #9
    135 #	nop #10
    136 #	.size local_outer, . - local_outer
    137 #	nop #11
    138 testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile49 \
    139     		0 1 2 3 4 5 6 7 8 9 \
    140 		0x100 0x101 0x102 0x103 0x104 0x105 \
    141 		0x106 0x107 0x108 0x109 0x10a 0x10b \
    142 		0x200 0x201 0x202 0x203 0x204 0x205 \
    143 		0x206 0x207 0x208 0x209 0x20a 0x20b <<\EOF
    144 (.text)+0
    145 ??:0
    146 sizeless_foo
    147 ??:0
    148 sizeless_foo+0x1
    149 ??:0
    150 sized_bar
    151 ??:0
    152 sized_bar+0x1
    153 ??:0
    154 sized_bar+0x2
    155 ??:0
    156 sized_bar+0x3
    157 ??:0
    158 (.text)+0x7
    159 ??:0
    160 (.text)+0x8
    161 ??:0
    162 sizeless_x
    163 ??:0
    164 sizeless_x+0xf7
    165 ??:0
    166 global_outer
    167 ??:0
    168 global_outer+0x1
    169 ??:0
    170 global_in_global
    171 ??:0
    172 global_in_global+0x1
    173 ??:0
    174 global_outer+0x4
    175 ??:0
    176 global_outer+0x5
    177 ??:0
    178 global_outer+0x6
    179 ??:0
    180 global_outer+0x7
    181 ??:0
    182 global_outer+0x8
    183 ??:0
    184 global_outer+0x9
    185 ??:0
    186 (.text)+0x10b
    187 ??:0
    188 (.text)+0x200
    189 ??:0
    190 local_outer
    191 ??:0
    192 local_outer+0x1
    193 ??:0
    194 global_in_local
    195 ??:0
    196 global_in_local+0x1
    197 ??:0
    198 local_in_local
    199 ??:0
    200 local_in_local+0x1
    201 ??:0
    202 local_outer+0x6
    203 ??:0
    204 local_outer+0x7
    205 ??:0
    206 local_outer+0x8
    207 ??:0
    208 local_outer+0x9
    209 ??:0
    210 (.text)+0x20b
    211 ??:0
    212 EOF
    213 
    214 #	.macro global label size
    215 #\label:	.globl \label
    216 #	.size \label, \size
    217 #	.endm
    218 #	.macro weak label size
    219 #\label:	.weak \label
    220 #	.size \label, \size
    221 #	.endm
    222 #	.macro local label size
    223 #\label:	.size \label, \size
    224 #	.endm
    225 #	.macro offset val
    226 #	.ifne (. - _start) - \val
    227 #	.err
    228 #	.endif
    229 #	.byte \val
    230 #	.endm
    231 #
    232 #_start:
    233 #	offset 0
    234 #
    235 #	local glocal, 1
    236 #	weak gweak, 1
    237 #	global gglobal1, 2
    238 #	global gglobal2, 1
    239 #	global gglobal3, 1
    240 #	offset 1
    241 #	/* Symbols end here.  */
    242 #	offset 2
    243 #	/* gglobal1 ends here.  */
    244 #	offset 3
    245 #
    246 #	local g0local, 0
    247 #	weak g0weak, 0
    248 #	global g0global1, 0
    249 #	global g0global2, 0
    250 #	offset 4
    251 #
    252 #	local wlocal, 1
    253 #	weak wweak1, 2
    254 #	weak wweak2, 1
    255 #	weak wweak3, 1
    256 #	offset 5
    257 #	/* Symbols end here.  */
    258 #	offset 6
    259 #	/* wweak1 ends here.  */
    260 #	offset 7
    261 #
    262 #	local w0local, 0
    263 #	weak w0weak1, 0
    264 #	weak w0weak2, 0
    265 #	offset 8
    266 #
    267 #	local llocal1, 2
    268 #	local llocal2, 1
    269 #	local llocal3, 1
    270 #	offset 9
    271 #	/* Symbols end here.  */
    272 #	offset 10
    273 #	/* llocal1 ends here.  */
    274 #	offset 11
    275 #
    276 #	local l0local1, 0
    277 #	local l0local2, 0
    278 #	offset 12
    279 testfiles testfile64
    280 testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile64 1 4 5 8 9 c <<\EOF
    281 gglobal2
    282 ??:0
    283 g0global2
    284 ??:0
    285 wweak2
    286 ??:0
    287 w0weak2
    288 ??:0
    289 llocal2
    290 ??:0
    291 l0local2
    292 ??:0
    293 EOF
    294 
    295 testfiles testfile65
    296 testrun_compare ${abs_top_builddir}/src/addr2line -S --core=testfile65 0x7fff94bffa30 <<\EOF
    297 __vdso_time
    298 ??:0
    299 EOF
    300 
    301 #	.section	".text"
    302 #	.globl _start
    303 #	.section	".opd","aw"
    304 #_start:	.quad	.L._start,.TOC.@tocbase
    305 #	.previous
    306 #	.type	_start, @function
    307 #.L._start:
    308 #	.byte	0x7d, 0x82, 0x10, 0x08
    309 #	.size	_start,.-.L._start
    310 testfiles testfile66 testfile66.core
    311 testrun_compare ${abs_top_builddir}/src/addr2line -x -e testfile66 _start 0x2d8 0x2db 0x2dc 0x103d0 0x103d3 0x103d4<<EOF
    312 _start (.text)
    313 ??:0
    314 _start (.text)
    315 ??:0
    316 _start+0x3 (.text)
    317 ??:0
    318 ()+0x2dc
    319 ??:0
    320 _start (.opd)
    321 ??:0
    322 _start+0x3 (.opd)
    323 ??:0
    324 ()+0x103d4
    325 ??:0
    326 EOF
    327 testrun_compare ${abs_top_builddir}/src/addr2line -x -e testfile66 --core=testfile66.core _start 0x461b02d8 0x461c03d0<<\EOF
    328 _start (.text)
    329 ??:0
    330 _start (.text)
    331 ??:0
    332 _start (.opd)
    333 ??:0
    334 EOF
    335 
    336 testfiles testfile69.core testfile69.so
    337 testrun_compare ${abs_top_builddir}/src/addr2line --core=./testfile69.core -S 0x7f0bc6a33535 0x7f0bc6a33546 <<\EOF
    338 libstatic+0x9
    339 ??:0
    340 libglobal+0x9
    341 ??:0
    342 EOF
    343 
    344 testfiles testfile70.exec testfile70.core
    345 testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile70.exec --core=testfile70.core 0x7ff2cfe9b6b5 <<\EOF
    346 main+0x9
    347 ??:0
    348 EOF
    349 testrun_compare ${abs_top_builddir}/src/addr2line -S --core=testfile70.core -e testfile70.exec 0x7ff2cfe9b6b5 <<\EOF
    350 main+0x9
    351 ??:0
    352 EOF
    353 
    354 testfiles test-core-lib.so test-core.core test-core.exec
    355 testrun_compare ${abs_top_builddir}/src/addr2line -S -e test-core.exec --core=test-core.core 0x7f67f2aaf619 <<\EOF
    356 libfunc+0x9
    357 ??:0
    358 EOF
    359 
    360 exit 0
    361