|
3 | 3 |
|
4 | 4 | ## Show that a bad length stops parsing of the section. |
5 | 5 | # RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_reserved_length.s -filetype=obj -o %t-reserved.o |
6 | | -# RUN: llvm-dwarfdump -debug-line %t-reserved.o 2>&1 \ |
7 | | -# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL,RESERVED |
8 | | -# RUN: llvm-dwarfdump -debug-line %t-reserved.o -verbose 2>&1 \ |
9 | | -# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL,RESERVED |
| 6 | +# RUN: llvm-dwarfdump -debug-line %t-reserved.o 2> %t-reserved.err \ |
| 7 | +# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL |
| 8 | +# RUN: FileCheck %s --input-file=%t-reserved.err --check-prefix=RESERVED |
| 9 | +# RUN: llvm-dwarfdump -debug-line %t-reserved.o -verbose 2> %t-reserved-verbose.err \ |
| 10 | +# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL |
| 11 | +# RUN: FileCheck %s --input-file=%t-reserved-verbose.err --check-prefix=RESERVED |
10 | 12 |
|
11 | 13 | ## We only produce warnings for malformed tables after the specified unit if |
12 | 14 | ## parsing can continue. |
13 | | -# RUN: llvm-dwarfdump -debug-line=0 %t-reserved.o 2>&1 \ |
14 | | -# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER,RESERVED |
| 15 | +# RUN: llvm-dwarfdump -debug-line=0 %t-reserved.o 2> %t-reserved-off-first.err \ |
| 16 | +# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER |
| 17 | +# RUN: FileCheck %s --input-file=%t-reserved-off-first.err --check-prefix=RESERVED |
15 | 18 |
|
16 | 19 | ## Stop looking for the specified unit, if a fatally-bad prologue is detected. |
17 | | -# RUN: llvm-dwarfdump -debug-line=0x4b %t-reserved.o 2>&1 \ |
18 | | -# RUN: | FileCheck %s --check-prefixes=NOFIRST,NOLATER,RESERVED |
| 20 | +# RUN: llvm-dwarfdump -debug-line=0x4b %t-reserved.o 2> %t-reserved-off-last.err \ |
| 21 | +# RUN: | FileCheck %s --check-prefixes=NOFIRST,NOLATER |
| 22 | +# RUN: FileCheck %s --input-file=%t-reserved-off-last.err --check-prefix=RESERVED |
19 | 23 |
|
20 | 24 | ## Show that non-fatal errors do not prevent parsing the rest of the section. |
21 | 25 | # RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_malformed.s -filetype=obj -o %t-malformed.o |
22 | | -# RUN: llvm-dwarfdump -debug-line %t-malformed.o 2>&1 \ |
23 | | -# RUN: | FileCheck %s --check-prefixes=FIRST,NONFATAL,LAST,ALL,OTHER --implicit-check-not='debug_line[{{.*}}]' |
24 | | -# RUN: llvm-dwarfdump -debug-line %t-malformed.o -verbose 2>&1 \ |
25 | | -# RUN: | FileCheck %s --check-prefixes=FIRST,NONFATAL,LAST,ALL,OTHER --implicit-check-not='debug_line[{{.*}}]' |
| 26 | +# RUN: llvm-dwarfdump -debug-line %t-malformed.o 2> %t-malformed.err \ |
| 27 | +# RUN: | FileCheck %s --check-prefixes=FIRST,NONFATAL,LAST --implicit-check-not='debug_line[{{.*}}]' |
| 28 | +# RUN: FileCheck %s --input-file=%t-malformed.err --check-prefixes=ALL,OTHER |
| 29 | +# RUN: llvm-dwarfdump -debug-line %t-malformed.o -verbose 2> %t-malformed-verbose.err \ |
| 30 | +# RUN: | FileCheck %s --check-prefixes=FIRST,NONFATAL,LAST --implicit-check-not='debug_line[{{.*}}]' |
| 31 | +# RUN: FileCheck %s --input-file=%t-malformed-verbose.err --check-prefixes=ALL,OTHER |
26 | 32 |
|
27 | 33 | ## We should still produce warnings for malformed tables after the specified unit. |
28 | | -# RUN: llvm-dwarfdump -debug-line=0 %t-malformed.o 2>&1 \ |
29 | | -# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER,ALL |
| 34 | +# RUN: llvm-dwarfdump -debug-line=0 %t-malformed.o 2> %t-malformed-off-first.err \ |
| 35 | +# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER |
| 36 | +# RUN: FileCheck %s --input-file=%t-malformed-off-first.err --check-prefix=ALL |
30 | 37 |
|
31 | 38 | ## Don't stop looking for the later unit if non-fatal issues are found. |
32 | | -# RUN: llvm-dwarfdump -debug-line=0x3c9 %t-malformed.o 2>&1 \ |
33 | | -# RUN: | FileCheck %s --check-prefixes=LAST,ALL --implicit-check-not='debug_line[{{.*}}]' |
| 39 | +# RUN: llvm-dwarfdump -debug-line=0x3c9 %t-malformed.o 2> %t-malformed-off-last.err \ |
| 40 | +# RUN: | FileCheck %s --check-prefix=LAST --implicit-check-not='debug_line[{{.*}}]' |
| 41 | +# RUN: FileCheck %s --input-file=%t-malformed-off-last.err --check-prefix=ALL |
34 | 42 |
|
35 | 43 | # FIRST: debug_line[0x00000000] |
36 | 44 | # FIRST: 0x000000000badbeef {{.*}} end_sequence |
|
41 | 49 |
|
42 | 50 | ## For fatal issues, the following table(s) should not be dumped: |
43 | 51 | # FATAL: debug_line[0x00000048] |
44 | | -# RESERVED-NOT: prologue |
45 | | -# RESERVED: warning: parsing line table prologue at offset 0x00000048 unsupported reserved unit length found of value 0xfffffffe |
46 | | -# RESERVED-NOT: prologue |
| 52 | +# FATAL-NEXT: Line table prologue |
| 53 | +# FATAL-NEXT: total_length: 0xfffffffe |
47 | 54 | # FATAL-NOT: debug_line |
48 | 55 |
|
49 | 56 | ## For non-fatal issues, the table data should be dumped: |
50 | 57 |
|
51 | 58 | ## Version 0 table. |
52 | 59 | # NONFATAL: debug_line[0x00000048] |
53 | | -# ALL: warning: parsing line table prologue at offset 0x00000048 found unsupported version 0 |
54 | 60 | # NONFATAL-NEXT: Line table prologue |
55 | | -# NONFATAL-NEXT: total_length: 0x00000002 |
56 | | -# NONFATAL-NEXT: version: 0 |
57 | | -# NONFATAL-NOT: prologue_length |
| 61 | +# NONFATAL-NOT: Address |
58 | 62 |
|
59 | 63 | ## Version 1 table. |
60 | 64 | # NONFATAL: debug_line[0x0000004e] |
61 | | -# ALL-NEXT: warning: parsing line table prologue at offset 0x0000004e found unsupported version 1 |
62 | 65 | # NONFATAL-NEXT: Line table prologue |
63 | | -# NONFATAL-NEXT: total_length: 0x00000002 |
64 | | -# NONFATAL-NEXT: version: 1 |
65 | | -# NONFATAL-NOT: prologue_length |
| 66 | +# NONFATAL-NOT: Address |
66 | 67 |
|
67 | 68 | ## Malformed directory format with no path component. |
68 | 69 | # NONFATAL: debug_line[0x00000054] |
69 | | -# ALL-NEXT: warning: parsing line table prologue at 0x00000054 found an invalid directory or file table description at 0x00000073 |
70 | | -# ALL-NEXT: warning: failed to parse entry content descriptions because no path was found |
71 | 70 | # NONFATAL-NEXT: Line table prologue |
72 | | -# NONFATAL: prologue_length: 0x00000013 |
73 | 71 | # NONFATAL-NOT: include_directories |
74 | 72 | # NONFATAL-NOT: file_names |
75 | 73 | # NONFATAL: 0x8877665544332211 {{.*}} end_sequence |
76 | 74 |
|
77 | 75 | ## Prologue with length shorter than parsed. |
78 | 76 | # NONFATAL: debug_line[0x00000081] |
79 | | -# ALL-NEXT: warning: parsing line table prologue at 0x00000081 found an invalid directory or file table description at 0x000000ba |
80 | | -# ALL-NEXT: warning: file names table was not null terminated before the end of the prologue |
81 | | -# ALL-NEXT: warning: parsing line table prologue at 0x00000081 should have ended at 0x000000b9 but it ended at 0x000000ba |
82 | 77 | # NONFATAL-NEXT: Line table prologue |
83 | 78 | # NONFATAL: file_names[ 2]: |
84 | 79 | # NONFATAL-NEXT: name: "file2" |
|
89 | 84 |
|
90 | 85 | ## Prologue with length longer than parsed. |
91 | 86 | # NONFATAL: debug_line[0x000000c8] |
92 | | -# ALL-NEXT: warning: parsing line table prologue at 0x000000c8 should have ended at 0x00000103 but it ended at 0x00000102 |
93 | 87 | # NONFATAL-NEXT: Line table prologue |
94 | 88 | # NONFATAL: file_names[ 2]: |
95 | 89 | # NONFATAL-NEXT: name: "file2" |
|
101 | 95 |
|
102 | 96 | ## Extended opcode with incorrect length versus expected. |
103 | 97 | # NONFATAL: debug_line[0x00000111] |
104 | | -# OTHER-NEXT: warning: unexpected line op length at offset 0x00000158 expected 0x02 found 0x01 |
105 | | -# OTHER-NEXT: warning: unexpected line op length at offset 0x0000015c expected 0x01 found 0x02 |
106 | 98 | # NONFATAL-NEXT: Line table prologue |
107 | | -# NONFATAL: prologue_length: 0x00000030 |
108 | 99 | # NONFATAL: 0x00000000abbadaba {{.*}} end_sequence |
109 | 100 | # NONFATAL: 0x00000000babb1e45 {{.*}} 10 is_stmt prologue_end end_sequence{{$}} |
110 | 101 |
|
111 | 102 | ## No end of sequence. |
112 | 103 | # NONFATAL: debug_line[0x0000016c] |
113 | | -# OTHER-NEXT: warning: last sequence in debug line table at offset 0x0000016c is not terminated |
114 | 104 | # NONFATAL-NEXT: Line table prologue |
115 | | -# NONFATAL: prologue_length: 0x00000030 |
116 | 105 | # NONFATAL: 0x00000000deadfade {{.*}} is_stmt |
117 | 106 | # NONFATAL-NOT: end_sequence |
118 | 107 |
|
119 | 108 | ## Very short prologue length for V5 (ends during parameters). |
120 | 109 | # NONFATAL: debug_line[0x000001b2] |
121 | | -# ALL-NEXT: warning: parsing line table prologue at 0x000001b2 should have ended at 0x000001ce but it ended at 0x000001e1 |
122 | 110 | # NONFATAL-NEXT: Line table prologue |
123 | 111 | # NONFATAL: standard_opcode_lengths[DW_LNS_set_isa] = 1 |
124 | 112 | # NONFATAL-NEXT: include_directories[ 0] = "/tmp" |
|
129 | 117 |
|
130 | 118 | ## V5 prologue ends during file table. |
131 | 119 | # NONFATAL: debug_line[0x000001ee] |
132 | | -# ALL-NEXT: warning: parsing line table prologue at 0x000001ee should have ended at 0x00000219 but it ended at 0x00000220 |
133 | 120 | # NONFATAL-NEXT: Line table prologue |
134 | 121 | # NONFATAL: include_directories[ 0] = "/tmp" |
135 | 122 | # NONFATAL-NEXT: file_names[ 0]: |
|
140 | 127 |
|
141 | 128 | ## V5 prologue ends during directory table. |
142 | 129 | # NONFATAL: debug_line[0x0000022f] |
143 | | -# ALL-NEXT: warning: parsing line table prologue at 0x0000022f should have ended at 0x00000251 but it ended at 0x0000025e |
144 | 130 | # NONFATAL-NEXT: Line table prologue |
145 | 131 | # NONFATAL: include_directories[ 0] = "/tmp" |
146 | 132 | # NONFATAL-NEXT: file_names[ 0]: |
|
150 | 136 |
|
151 | 137 | ## V5 invalid MD5 hash form when there is still data to be read. |
152 | 138 | # NONFATAL: debug_line[0x0000026b] |
153 | | -# ALL-NEXT: warning: parsing line table prologue at 0x0000026b found an invalid directory or file table description at 0x0000029f |
154 | | -# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid |
155 | 139 | # NONFATAL-NEXT: Line table prologue |
156 | 140 | # NONFATAL: include_directories[ 0] = "/tmp" |
157 | 141 | # NONFATAL-NOT: file_names |
|
161 | 145 | ## V5 invalid MD5 hash form when data beyond the prologue length has |
162 | 146 | ## been read before the MD5 problem is identified. |
163 | 147 | # NONFATAL: debug_line[0x000002ae] |
164 | | -# ALL-NEXT: warning: parsing line table prologue at 0x000002ae found an invalid directory or file table description at 0x000002e0 |
165 | | -# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid |
166 | | -# ALL-NEXT: warning: parsing line table prologue at 0x000002ae should have ended at 0x000002d9 but it ended at 0x000002e0 |
167 | 148 | # NONFATAL-NEXT: Line table prologue |
168 | 149 | # NONFATAL: include_directories[ 0] = "/tmp" |
169 | 150 | # NONFATAL-NOT: file_names |
|
172 | 153 |
|
173 | 154 | ## V5 invalid directory content description has unsupported form. |
174 | 155 | # NONFATAL: debug_line[0x000002ec] |
175 | | -# ALL-NEXT: warning: parsing line table prologue at 0x000002ec found an invalid directory or file table description at 0x00000315 |
176 | | -# ALL-NEXT: warning: failed to parse directory entry because skipping the form value failed. |
177 | 156 | # NONFATAL-NEXT: Line table prologue |
178 | 157 | # NONFATAL: include_directories[ 0] = "/foo" |
179 | 158 | # NONFATAL-NOT: include_directories |
|
182 | 161 |
|
183 | 162 | ## Opcode base field of value zero. |
184 | 163 | # NONFATAL: debug_line[0x00000332] |
185 | | -# ALL-NEXT: warning: parsing line table prologue at offset 0x00000332 found opcode base of 0. Assuming no standard opcodes |
186 | 164 | # NONFATAL-NEXT: Line table prologue |
187 | 165 | # NONFATAL: include_directories[ 1] = "dir1" |
188 | 166 | # NONFATAL-NEXT: file_names[ 1]: |
|
195 | 173 |
|
196 | 174 | ## V4 table with unterminated include directory table. |
197 | 175 | # NONFATAL: debug_line[0x00000361] |
198 | | -# ALL-NEXT: warning: parsing line table prologue at 0x00000361 found an invalid directory or file table description at 0x00000382 |
199 | | -# ALL-NEXT: warning: include directories table was not null terminated before the end of the prologue |
200 | 176 | # NONFATAL-NEXT: Line table prologue |
201 | 177 | # NONFATAL: include_directories[ 1] = "dir1" |
202 | 178 | # NONFATAL-NOT: file_names |
203 | 179 | # NONFATAL: 0xabcdef0123456789 {{.*}} is_stmt end_sequence |
204 | 180 |
|
205 | 181 | ## V4 table with unterminated file name table. |
206 | 182 | # NONFATAL: debug_line[0x00000390] |
207 | | -# ALL-NEXT: warning: parsing line table prologue at 0x00000390 found an invalid directory or file table description at 0x000003bb |
208 | | -# ALL-NEXT: warning: file names table was not null terminated before the end of the prologue |
209 | 183 | # NONFATAL-NEXT: Line table prologue |
210 | 184 | # NONFATAL: file_names[ 1]: |
211 | 185 | # NONFATAL-NEXT: name: "foo.c" |
|
217 | 191 |
|
218 | 192 | # LAST: debug_line[0x000003c9] |
219 | 193 | # LAST: 0x00000000cafebabe {{.*}} end_sequence |
| 194 | + |
| 195 | +# RESERVED: warning: parsing line table prologue at offset 0x00000048 unsupported reserved unit length found of value 0xfffffffe |
| 196 | + |
| 197 | +# ALL-NOT: warning: |
| 198 | +# ALL: warning: parsing line table prologue at offset 0x00000048 found unsupported version 0 |
| 199 | +# ALL-NEXT: warning: parsing line table prologue at offset 0x0000004e found unsupported version 1 |
| 200 | +# ALL-NEXT: warning: parsing line table prologue at 0x00000054 found an invalid directory or file table description at 0x00000073 |
| 201 | +# ALL-NEXT: warning: failed to parse entry content descriptions because no path was found |
| 202 | +# ALL-NEXT: warning: parsing line table prologue at 0x00000081 found an invalid directory or file table description at 0x000000ba |
| 203 | +# ALL-NEXT: warning: file names table was not null terminated before the end of the prologue |
| 204 | +# ALL-NEXT: warning: parsing line table prologue at 0x00000081 should have ended at 0x000000b9 but it ended at 0x000000ba |
| 205 | +# ALL-NEXT: warning: parsing line table prologue at 0x000000c8 should have ended at 0x00000103 but it ended at 0x00000102 |
| 206 | +# OTHER-NEXT: warning: unexpected line op length at offset 0x00000158 expected 0x02 found 0x01 |
| 207 | +# OTHER-NEXT: warning: unexpected line op length at offset 0x0000015c expected 0x01 found 0x02 |
| 208 | +# OTHER-NEXT: warning: last sequence in debug line table at offset 0x0000016c is not terminated |
| 209 | +# ALL-NEXT: warning: parsing line table prologue at 0x000001b2 should have ended at 0x000001ce but it ended at 0x000001e1 |
| 210 | +# ALL-NEXT: warning: parsing line table prologue at 0x000001ee should have ended at 0x00000219 but it ended at 0x00000220 |
| 211 | +# ALL-NEXT: warning: parsing line table prologue at 0x0000022f should have ended at 0x00000251 but it ended at 0x0000025e |
| 212 | +# ALL-NEXT: warning: parsing line table prologue at 0x0000026b found an invalid directory or file table description at 0x0000029f |
| 213 | +# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid |
| 214 | +# ALL-NEXT: warning: parsing line table prologue at 0x000002ae found an invalid directory or file table description at 0x000002e0 |
| 215 | +# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid |
| 216 | +# ALL-NEXT: warning: parsing line table prologue at 0x000002ae should have ended at 0x000002d9 but it ended at 0x000002e0 |
| 217 | +# ALL-NEXT: warning: parsing line table prologue at 0x000002ec found an invalid directory or file table description at 0x00000315 |
| 218 | +# ALL-NEXT: warning: failed to parse directory entry because skipping the form value failed. |
| 219 | +# ALL-NEXT: warning: parsing line table prologue at offset 0x00000332 found opcode base of 0. Assuming no standard opcodes |
| 220 | +# ALL-NEXT: warning: parsing line table prologue at 0x00000361 found an invalid directory or file table description at 0x00000382 |
| 221 | +# ALL-NEXT: warning: include directories table was not null terminated before the end of the prologue |
| 222 | +# ALL-NEXT: warning: parsing line table prologue at 0x00000390 found an invalid directory or file table description at 0x000003bb |
| 223 | +# ALL-NEXT: warning: file names table was not null terminated before the end of the prologue |
| 224 | +# ALL-NOT: warning: |
0 commit comments