summaryrefslogtreecommitdiffstats
path: root/tests/run-all-dwarf-ranges.sh
blob: 61141cfa6f72f61a865459c71d2d6865d5fae74f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#! /bin/sh
# Copyright (C) 2018 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# elfutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

. $srcdir/test-subr.sh

# See run-dwarf-ranges.sh
# Compiled with:
# gcc -c -O2 -o testfile-ranges-hello.o -gsplit-dwarf -gdwarf-4 hello.c
# gcc -c -O2 -o testfile-ranges-world.o -gsplit-dwarf -gdwarf-4 world.c
# gcc -o testfilesplitranges4 -O2 \
#        testfile-ranges-hello.o testfile-ranges-world.o
# eu-strip -f testfilesplitranges4.debug testfilesplitranges4

testfiles testfilesplitranges4.debug
testfiles testfile-ranges-hello.dwo testfile-ranges-world.dwo

testrun_compare ${abs_builddir}/all-dwarf-ranges testfilesplitranges4.debug <<\EOF
die: hello.c (11)
 4004e0..4004ff
 4003e0..4003f7

die: no_say (2e)
 4004f0..4004ff

die: main (2e)
 4003e0..4003f7

die: subject (1d)
 4003e3..4003ef

die: subject (2e)
 4004e0..4004f0

die: world.c (11)
 400500..400567

die: no_main (2e)
 400550..400567

die: no_subject (1d)
 400553..40055f

die: say (2e)
 400500..400540

die: happy (1d)
 40051c..400526
 400530..400534
 400535..40053f

die: sad (1d)
 40051c..400526
 400535..40053f

die: no_subject (2e)
 400540..400550

EOF

# Same with -gdwarf-5
# gcc -c -O2 -o testfile-ranges-hello5.o -gsplit-dwarf -gdwarf-5 hello.c
# gcc -c -O2 -o testfile-ranges-world5.o -gsplit-dwarf -gdwarf-5 world.c
# gcc -o testfilesplitranges5 -O2 testfile-ranges-hello5.o testfile-ranges-world5.o
# eu-strip -f testfilesplitranges5.debug testfilesplitranges5

testfiles testfilesplitranges5.debug
testfiles testfile-ranges-hello5.dwo testfile-ranges-world5.dwo

testrun_compare ${abs_builddir}/all-dwarf-ranges testfilesplitranges5.debug <<\EOF
die: hello.c (11)
 401150..40117a
 401050..401067

die: no_say (2e)
 401160..40117a

die: main (2e)
 401050..401067

die: subject (1d)
 401053..40105f

die: subject (2e)
 401150..401160

die: world.c (11)
 401180..4011e7

die: no_main (2e)
 4011d0..4011e7

die: no_subject (1d)
 4011d3..4011df

die: say (2e)
 401180..4011c0

die: happy (1d)
 40119b..40119b
 40119c..4011a6
 4011b0..4011b4
 4011b5..4011bf

die: sad (1d)
 40119b..40119b
 40119c..4011a6
 4011b4..4011b4
 4011b5..4011bf

die: no_subject (2e)
 4011c0..4011d0

EOF

# See testfile-dwp.source.
testfiles testfile-dwp-5 testfile-dwp-5.dwp
testfiles testfile-dwp-4 testfile-dwp-4.dwp

testrun_compare ${abs_builddir}/all-dwarf-ranges testfile-dwp-5 << EOF
die: foo.cc (11)
 401190..401200

die: foo (2e)
 4011c0..401200

die: x_x (1d)
 4011cb..4011eb
 4011f8..401200

die: <unknown> (b)
 4011cb..4011eb
 4011f8..401200

die: x_x (2e)
 401190..4011bd

die: <unknown> (b)
 401190..401190
 401192..4011bb

die: bar.cc (11)
 401200..40121b

die: bar (2e)
 401200..40121b

die: main.cc (11)
 401020..4010a0

die: main (2e)
 401020..4010a0

die: fibonacci (1d)
 401030..401032
 401036..401060
 401099..4010a0

die: fibonacci (1d)
 40103a..401060
 401099..4010a0

die: <unknown> (b)
 40103a..401060
 401099..4010a0

die: <unknown> (b)
 40103a..401044
 401050..401060

die: <unknown> (b)
 401050..401053
 401056..401059

EOF

testrun_compare ${abs_builddir}/all-dwarf-ranges testfile-dwp-4 << EOF
die: foo.cc (11)
 401190..401200

die: foo (2e)
 4011c0..401200

die: x_x (1d)
 4011cb..4011eb
 4011f8..401200

die: <unknown> (b)
 4011cb..4011eb
 4011f8..401200

die: x_x (2e)
 401190..4011bd

die: bar.cc (11)
 401200..40121b

die: bar (2e)
 401200..40121b

die: main.cc (11)
 401020..4010a0

die: main (2e)
 401020..4010a0

die: fibonacci (1d)
 401030..401032
 401036..401060
 401099..4010a0

die: fibonacci (1d)
 40103a..401060
 401099..4010a0

die: <unknown> (b)
 40103a..401060
 401099..4010a0

die: <unknown> (b)
 40103a..401044
 401050..401060

die: <unknown> (b)
 401050..401053
 401056..401059

EOF

exit 0