summaryrefslogtreecommitdiff
path: root/tests/run-readelf-str.sh
blob: 8b894e8d2ecfe9229d53997af47baccd3b0e063c (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
#! /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 tests/testfile-dwarf-45.source
testfiles testfile-splitdwarf-4 testfile-splitdwarf-5
testfiles testfile-hello4.dwo testfile-hello5.dwo
testfiles testfile-world4.dwo testfile-world5.dwo

# DWARF4 GNU DebugFission No real table header.
# We don't really need the skeleton, but we don't want any Warnings.
testrun_compare ${abs_top_builddir}/src/readelf --dwarf-skeleton testfile-splitdwarf-4 --debug-dump=str testfile-hello4.dwo testfile-world4.dwo<<\EOF

testfile-hello4.dwo:


DWARF section [ 5] '.debug_str_offsets.dwo' at offset 0x335:
Table at offset 0 
 Offsets start at 0x0:
 [ 0] [       0]  "long long int"
 [ 1] [       e]  "frob"
 [ 2] [      13]  "long unsigned int"
 [ 3] [      25]  "/home/mark/src/elfutils/tests"
 [ 4] [      43]  "wchar_t"
 [ 5] [      4b]  "main"
 [ 6] [      50]  "long int"
 [ 7] [      59]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-4 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [ 8] [      e9]  "long double"
 [ 9] [      f5]  "hello.c"


DWARF section [ 6] '.debug_str.dwo' at offset 0x35d:
 Offset  String
 [   0]  "long long int"
 [   e]  "frob"
 [  13]  "long unsigned int"
 [  25]  "/home/mark/src/elfutils/tests"
 [  43]  "wchar_t"
 [  4b]  "main"
 [  50]  "long int"
 [  59]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-4 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [  e9]  "long double"
 [  f5]  "hello.c"

testfile-world4.dwo:


DWARF section [ 5] '.debug_str_offsets.dwo' at offset 0x2e7:
Table at offset 0 
 Offsets start at 0x0:
 [ 0] [       0]  "long long unsigned int"
 [ 1] [      17]  "/home/mark/src/elfutils/tests"
 [ 2] [      35]  "long long int"
 [ 3] [      43]  "signed char"
 [ 4] [      4f]  "long int"
 [ 5] [      58]  "world.c"
 [ 6] [      60]  "unsigned int"
 [ 7] [      6d]  "long unsigned int"
 [ 8] [      7f]  "short unsigned int"
 [ 9] [      92]  "frob"
 [10] [      97]  "calc"
 [11] [      9c]  "unsigned char"
 [12] [      aa]  "short int"
 [13] [      b4]  "exit"
 [14] [      b9]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-4 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [15] [     149]  "char"
 [16] [     14e]  "word"
 [17] [     153]  "argv"
 [18] [     158]  "argc"
 [19] [     15d]  "main"


DWARF section [ 6] '.debug_str.dwo' at offset 0x337:
 Offset  String
 [   0]  "long long unsigned int"
 [  17]  "/home/mark/src/elfutils/tests"
 [  35]  "long long int"
 [  43]  "signed char"
 [  4f]  "long int"
 [  58]  "world.c"
 [  60]  "unsigned int"
 [  6d]  "long unsigned int"
 [  7f]  "short unsigned int"
 [  92]  "frob"
 [  97]  "calc"
 [  9c]  "unsigned char"
 [  aa]  "short int"
 [  b4]  "exit"
 [  b9]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-4 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [ 149]  "char"
 [ 14e]  "word"
 [ 153]  "argv"
 [ 158]  "argc"
 [ 15d]  "main"
EOF

# DWARF5 Real table header.
# We don't really need the skeleton, but we don't want any Warnings.
testrun_compare ${abs_top_builddir}/src/readelf --dwarf-skeleton testfile-splitdwarf-5 --debug-dump=str testfile-hello5.dwo testfile-world5.dwo<<\EOF

testfile-hello5.dwo:


DWARF section [ 5] '.debug_str_offsets.dwo' at offset 0x353:
Table at offset 0 

 Length:              44
 Offset size:          4
 DWARF version:        5
 Padding:              0

 Offsets start at 0x8:
 [ 0] [       0]  "long long int"
 [ 1] [       e]  "frob"
 [ 2] [      13]  "long unsigned int"
 [ 3] [      25]  "/home/mark/src/elfutils/tests"
 [ 4] [      43]  "wchar_t"
 [ 5] [      4b]  "main"
 [ 6] [      50]  "long int"
 [ 7] [      59]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [ 8] [      e9]  "long double"
 [ 9] [      f5]  "hello.c"


DWARF section [ 6] '.debug_str.dwo' at offset 0x383:
 Offset  String
 [   0]  "long long int"
 [   e]  "frob"
 [  13]  "long unsigned int"
 [  25]  "/home/mark/src/elfutils/tests"
 [  43]  "wchar_t"
 [  4b]  "main"
 [  50]  "long int"
 [  59]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [  e9]  "long double"
 [  f5]  "hello.c"

testfile-world5.dwo:


DWARF section [ 5] '.debug_str_offsets.dwo' at offset 0x313:
Table at offset 0 

 Length:              84
 Offset size:          4
 DWARF version:        5
 Padding:              0

 Offsets start at 0x8:
 [ 0] [       0]  "long long unsigned int"
 [ 1] [      17]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [ 2] [      a7]  "/home/mark/src/elfutils/tests"
 [ 3] [      c5]  "long long int"
 [ 4] [      d3]  "signed char"
 [ 5] [      df]  "long int"
 [ 6] [      e8]  "world.c"
 [ 7] [      f0]  "unsigned int"
 [ 8] [      fd]  "long unsigned int"
 [ 9] [     10f]  "short unsigned int"
 [10] [     122]  "frob"
 [11] [     127]  "calc"
 [12] [     12c]  "unsigned char"
 [13] [     13a]  "short int"
 [14] [     144]  "exit"
 [15] [     149]  "char"
 [16] [     14e]  "word"
 [17] [     153]  "argv"
 [18] [     158]  "argc"
 [19] [     15d]  "main"


DWARF section [ 6] '.debug_str.dwo' at offset 0x36b:
 Offset  String
 [   0]  "long long unsigned int"
 [  17]  "GNU C17 9.0.0 20180515 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -gsplit-dwarf -gno-as-loc-support -gno-variable-location-views -O2"
 [  a7]  "/home/mark/src/elfutils/tests"
 [  c5]  "long long int"
 [  d3]  "signed char"
 [  df]  "long int"
 [  e8]  "world.c"
 [  f0]  "unsigned int"
 [  fd]  "long unsigned int"
 [ 10f]  "short unsigned int"
 [ 122]  "frob"
 [ 127]  "calc"
 [ 12c]  "unsigned char"
 [ 13a]  "short int"
 [ 144]  "exit"
 [ 149]  "char"
 [ 14e]  "word"
 [ 153]  "argv"
 [ 158]  "argc"
 [ 15d]  "main"
EOF

exit 0