summaryrefslogtreecommitdiff
path: root/tests/run-readelf-multi-noline.sh
blob: d72a9fd4ed249eaca1d39b05b73c10cdd820d366 (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
#! /bin/sh
# Copyright (C) 2021 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

# = a.c =
# int a;

# = b.c =
# int b;

# = m.c =
# int main () { }

# gcc -g -o testfile_multi_noline a.c b.c m.c

testfiles testfile_multi_noline

testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=line testfile_multi_noline <<\EOF

DWARF section [29] '.debug_line' at offset 0x1221:

Table at offset 0:

 Length:                         32
 DWARF version:                  3
 Prologue length:                26
 Address size:                   8
 Segment selector size:          0
 Min instruction length:         4
 Max operations per instruction: 1
 Initial value if 'is_stmt':     1
 Line base:                      -5
 Line range:                     14
 Opcode base:                    13

Opcodes:
  [ 1]  0 arguments
  [ 2]  1 argument
  [ 3]  1 argument
  [ 4]  1 argument
  [ 5]  1 argument
  [ 6]  0 arguments
  [ 7]  0 arguments
  [ 8]  0 arguments
  [ 9]  1 argument
  [10]  0 arguments
  [11]  0 arguments
  [12]  1 argument

Directory table:

File name table:
 Entry Dir   Time      Size      Name
 1     0     0         0         a.c

No line number statements.

Table at offset 36:

 Length:                         32
 DWARF version:                  3
 Prologue length:                26
 Address size:                   8
 Segment selector size:          0
 Min instruction length:         4
 Max operations per instruction: 1
 Initial value if 'is_stmt':     1
 Line base:                      -5
 Line range:                     14
 Opcode base:                    13

Opcodes:
  [ 1]  0 arguments
  [ 2]  1 argument
  [ 3]  1 argument
  [ 4]  1 argument
  [ 5]  1 argument
  [ 6]  0 arguments
  [ 7]  0 arguments
  [ 8]  0 arguments
  [ 9]  1 argument
  [10]  0 arguments
  [11]  0 arguments
  [12]  1 argument

Directory table:

File name table:
 Entry Dir   Time      Size      Name
 1     0     0         0         b.c

No line number statements.

Table at offset 72:

 Length:                         54
 DWARF version:                  3
 Prologue length:                26
 Address size:                   8
 Segment selector size:          0
 Min instruction length:         4
 Max operations per instruction: 1
 Initial value if 'is_stmt':     1
 Line base:                      -5
 Line range:                     14
 Opcode base:                    13

Opcodes:
  [ 1]  0 arguments
  [ 2]  1 argument
  [ 3]  1 argument
  [ 4]  1 argument
  [ 5]  1 argument
  [ 6]  0 arguments
  [ 7]  0 arguments
  [ 8]  0 arguments
  [ 9]  1 argument
  [10]  0 arguments
  [11]  0 arguments
  [12]  1 argument

Directory table:

File name table:
 Entry Dir   Time      Size      Name
 1     0     0         0         m.c

Line number statements:
 [    6c] set column to 13
 [    6e] extended opcode 2:  set address to +0x724 <main>
 [    79] copy
 [    7a] set column to 15
 [    7c] special opcode 32: address+4 = +0x728 <main+0x4>, line+0 = 1
 [    7d] advance address by 4 to +0x72c
 [    7f] extended opcode 1:  end of sequence
EOF

testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=decodedline testfile_multi_noline <<\EOF

DWARF section [29] '.debug_line' at offset 0x1221:

 CU [b] a.c
  line:col SBPE* disc isa op address (Statement Block Prologue Epilogue *End)
 CU [44] b.c
  line:col SBPE* disc isa op address (Statement Block Prologue Epilogue *End)
 CU [7d] m.c
  line:col SBPE* disc isa op address (Statement Block Prologue Epilogue *End)
  /tmp/m.c (mtime: 0, length: 0)
     1:13  S        0   0  0 +0x0000000000000724 <main>
     1:15  S        0   0  0 +0x0000000000000728 <main+0x4>
     1:15  S   *    0   0  0 +0x000000000000072b <main+0x7>

EOF

exit 0