Imported Upstream version 0.155
[platform/upstream/elfutils.git] / tests / run-addrname-test.sh
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 ../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 ../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 ../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 ../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 ../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 exit 0