363 lines · plain
1# RUN: yaml2obj --docnum=1 %s -o %t.name.o2# RUN: llvm-dwarfdump --show-sources %t.name.o | \3# RUN: FileCheck --check-prefix=CU-NAME --match-full-lines \4# RUN: --implicit-check-not={{.}} %s5 6# CU-NAME: first.c7# CU-NAME-NEXT: second.c8 9--- !ELF10FileHeader:11 Class: ELFCLASS6412 Data: ELFDATA2LSB13 Type: ET_REL14 Machine: EM_X86_6415DWARF:16 debug_abbrev:17 - Table:18 - Code: 119 Tag: DW_TAG_compile_unit20 Children: DW_CHILDREN_no21 Attributes:22 - Attribute: DW_AT_name23 Form: DW_FORM_string24 - Table:25 - Code: 126 Tag: DW_TAG_compile_unit27 Children: DW_CHILDREN_no28 Attributes:29 - Attribute: DW_AT_name30 Form: DW_FORM_string31 debug_info:32 - Version: 433 Entries:34 - AbbrCode: 135 Values:36 - CStr: first.c37 - Version: 438 Entries:39 - AbbrCode: 140 Values:41 - CStr: second.c42 43# RUN: yaml2obj --docnum=2 %s -o %t.comp-dir.o44# RUN: llvm-dwarfdump --show-sources %t.comp-dir.o 2>&1 | \45# RUN: FileCheck -DFILE=%t.comp-dir.o --check-prefix=CU-COMP-DIR \46# RUN: --match-full-lines --implicit-check-not={{.}} %s47 48# CU-COMP-DIR: warning: [[FILE]]: missing name for compilation unit49# CU-COMP-DIR-NEXT: warning: [[FILE]]: missing name for compilation unit50 51--- !ELF52FileHeader:53 Class: ELFCLASS6454 Data: ELFDATA2LSB55 Type: ET_REL56 Machine: EM_X86_6457DWARF:58 debug_abbrev:59 - Table:60 - Code: 161 Tag: DW_TAG_compile_unit62 Children: DW_CHILDREN_no63 Attributes:64 - Attribute: DW_AT_comp_dir65 Form: DW_FORM_string66 - Table:67 - Code: 168 Tag: DW_TAG_compile_unit69 Children: DW_CHILDREN_no70 Attributes:71 - Attribute: DW_AT_comp_dir72 Form: DW_FORM_string73 debug_info:74 - Version: 475 Entries:76 - AbbrCode: 177 Values:78 - CStr: /comp/first79 - Version: 480 Entries:81 - AbbrCode: 182 Values:83 - CStr: /comp/second84 85# RUN: yaml2obj --docnum=3 \86# RUN: -DFIRST_NAME=first.c -DFIRST_COMP_DIR=/comp/first \87# RUN: -DSECOND_NAME=second.c -DSECOND_COMP_DIR=/comp/second \88# RUN: -o %t.comp-dir-rel-name.o %s89# RUN: llvm-dwarfdump --show-sources %t.comp-dir-rel-name.o | \90# RUN: FileCheck --check-prefix=CU-COMP-DIR-REL-NAME --match-full-lines \91# RUN: --implicit-check-not={{.}} %s92 93# CU-COMP-DIR-REL-NAME: /comp/first[[SEP:[/\\]]]first.c94# CU-COMP-DIR-REL-NAME-NEXT: /comp/second[[SEP]]second.c95 96--- !ELF97FileHeader:98 Class: ELFCLASS6499 Data: ELFDATA2LSB100 Type: ET_REL101 Machine: EM_X86_64102DWARF:103 debug_abbrev:104 - Table:105 - Code: 1106 Tag: DW_TAG_compile_unit107 Children: DW_CHILDREN_no108 Attributes:109 - Attribute: DW_AT_name110 Form: DW_FORM_string111 - Attribute: DW_AT_comp_dir112 Form: DW_FORM_string113 - Table:114 - Code: 1115 Tag: DW_TAG_compile_unit116 Children: DW_CHILDREN_no117 Attributes:118 - Attribute: DW_AT_name119 Form: DW_FORM_string120 - Attribute: DW_AT_comp_dir121 Form: DW_FORM_string122 debug_info:123 - Version: 4124 Entries:125 - AbbrCode: 1126 Values:127 - CStr: [[FIRST_NAME]]128 - CStr: [[FIRST_COMP_DIR]]129 - Version: 4130 Entries:131 - AbbrCode: 1132 Values:133 - CStr: [[SECOND_NAME]]134 - CStr: [[SECOND_COMP_DIR]]135 136# RUN: yaml2obj --docnum=3 -o %t.comp-dir-abs-name-posix.o \137# RUN: -DFIRST_NAME=/abs/first.c -DFIRST_COMP_DIR=/comp/dir \138# RUN: -DSECOND_NAME=/abs/second.c -DSECOND_COMP_DIR=/comp/dir \139# RUN: %s140# RUN: llvm-dwarfdump --show-sources %t.comp-dir-abs-name-posix.o | \141# RUN: FileCheck --check-prefix=CU-COMP-DIR-ABS-NAME-POSIX \142# RUN: --match-full-lines --implicit-check-not={{.}} %s143 144# CU-COMP-DIR-ABS-NAME-POSIX: /abs/first.c145# CU-COMP-DIR-ABS-NAME-POSIX-NEXT: /abs/second.c146 147# RUN: yaml2obj --docnum=3 -o %t.comp-dir-abs-name-windows.o \148# RUN: -DFIRST_NAME='C:\abs\first.c' -DFIRST_COMP_DIR='C:\comp\dir' \149# RUN: -DSECOND_NAME='C:\abs\second.c' -DSECOND_COMP_DIR='C:\comp\dir' \150# RUN: %s151# RUN: llvm-dwarfdump --show-sources %t.comp-dir-abs-name-windows.o | \152# RUN: FileCheck --check-prefix=CU-COMP-DIR-ABS-NAME-WINDOWS \153# RUN: --match-full-lines --implicit-check-not={{.}} %s154 155# CU-COMP-DIR-ABS-NAME-WINDOWS: C:\abs\first.c156# CU-COMP-DIR-ABS-NAME-WINDOWS-NEXT: C:\abs\second.c157 158# RUN: yaml2obj --docnum=4 %s -o %t.line-table-abs.o159# RUN: llvm-dwarfdump --show-sources %t.line-table-abs.o | \160# RUN: FileCheck --check-prefix=LINE-TABLE-ABS --match-full-lines \161# RUN: --implicit-check-not={{.}} %s162 163# LINE-TABLE-ABS: /comp/first[[SEP:[/\\]]]first.c164# LINE-TABLE-ABS-NEXT: /comp/second[[SEP]]second.c165 166--- !ELF167FileHeader:168 Class: ELFCLASS64169 Data: ELFDATA2LSB170 Type: ET_REL171 Machine: EM_X86_64172DWARF:173 debug_line:174 - Version: 4175 MinInstLength: 1176 MaxOpsPerInst: 1177 DefaultIsStmt: 1178 LineBase: 0179 LineRange: 0180 OpcodeBase: 1181 IncludeDirs: [/comp/first]182 Files:183 - Name: first.c184 DirIdx: 1185 ModTime: 0186 Length: 0187 - Version: 4188 MinInstLength: 1189 MaxOpsPerInst: 1190 DefaultIsStmt: 1191 LineBase: 0192 LineRange: 0193 OpcodeBase: 1194 IncludeDirs: [/comp/second]195 Files:196 - Name: second.c197 DirIdx: 1198 ModTime: 0199 Length: 0200 201# RUN: yaml2obj --docnum=5 %s -o %t.line-table-rel.o202# RUN: llvm-dwarfdump --show-sources %t.line-table-rel.o | \203# RUN: FileCheck --check-prefix=LINE-TABLE-REL --match-full-lines \204# RUN: --implicit-check-not={{.}} %s205 206# LINE-TABLE-REL: first.c207# LINE-TABLE-REL-NEXT: second.c208 209--- !ELF210FileHeader:211 Class: ELFCLASS64212 Data: ELFDATA2LSB213 Type: ET_REL214 Machine: EM_X86_64215DWARF:216 debug_line:217 - Version: 4218 MinInstLength: 1219 MaxOpsPerInst: 1220 DefaultIsStmt: 1221 LineBase: 0222 LineRange: 0223 OpcodeBase: 1224 Files:225 - Name: first.c226 DirIdx: 0227 ModTime: 0228 Length: 0229 - Version: 4230 MinInstLength: 1231 MaxOpsPerInst: 1232 DefaultIsStmt: 1233 LineBase: 0234 LineRange: 0235 OpcodeBase: 1236 Files:237 - Name: second.c238 DirIdx: 0239 ModTime: 0240 Length: 0241 242# RUN: yaml2obj --docnum=6 %s -o %t.cu-line-table.o243# RUN: llvm-dwarfdump --show-sources %t.cu-line-table.o | \244# RUN: FileCheck --check-prefix=CU-LINE-TABLE --match-full-lines \245# RUN: --implicit-check-not={{.}} %s246 247# CU-LINE-TABLE: /first[[SEP:[/\\]]]first[[SEP]]first.c248# CU-LINE-TABLE-NEXT: /second[[SEP]]second[[SEP]]second.c249 250--- !ELF251FileHeader:252 Class: ELFCLASS64253 Data: ELFDATA2LSB254 Type: ET_REL255 Machine: EM_X86_64256DWARF:257 debug_abbrev:258 - Table:259 - Code: 1260 Tag: DW_TAG_compile_unit261 Children: DW_CHILDREN_no262 Attributes:263 - Attribute: DW_AT_comp_dir264 Form: DW_FORM_string265 - Attribute: DW_AT_stmt_list266 Form: DW_FORM_sec_offset267 - Table:268 - Code: 1269 Tag: DW_TAG_compile_unit270 Children: DW_CHILDREN_no271 Attributes:272 - Attribute: DW_AT_comp_dir273 Form: DW_FORM_string274 - Attribute: DW_AT_stmt_list275 Form: DW_FORM_sec_offset276 debug_info:277 - Version: 4278 Entries:279 - AbbrCode: 1280 Values:281 - CStr: /first282 - Value: 0283 - Version: 4284 Entries:285 - AbbrCode: 1286 Values:287 - CStr: /second288 - Value: 0x23289 debug_line:290 - Version: 4291 MinInstLength: 1292 MaxOpsPerInst: 1293 DefaultIsStmt: 1294 LineBase: 0295 LineRange: 0296 OpcodeBase: 1297 IncludeDirs: [first]298 Files:299 - Name: first.c300 DirIdx: 1301 ModTime: 0302 Length: 0303 - Version: 4304 MinInstLength: 1305 MaxOpsPerInst: 1306 DefaultIsStmt: 1307 LineBase: 0308 LineRange: 0309 OpcodeBase: 1310 IncludeDirs: [second]311 Files:312 - Name: second.c313 DirIdx: 1314 ModTime: 0315 Length: 0316 317# RUN: llvm-dwarfdump --show-sources %t.line-table-rel.o %t.cu-line-table.o | \318# RUN: FileCheck --check-prefix=MULTIPLE-FILES --match-full-lines \319# RUN: --implicit-check-not={{.}} %s320 321# MULTIPLE-FILES: first.c322# MULTIPLE-FILES-NEXT: second.c323# MULTIPLE-FILES-NEXT: /first[[SEP:[/\\]]]first[[SEP]]first.c324# MULTIPLE-FILES-NEXT: /second[[SEP]]second[[SEP]]second.c325 326# RUN: yaml2obj --docnum=7 %s -o %t.no-filenames.o327# RUN: llvm-dwarfdump --show-sources %t.no-filenames.o | count 0328 329--- !ELF330FileHeader:331 Class: ELFCLASS64332 Data: ELFDATA2LSB333 Type: ET_REL334 Machine: EM_X86_64335DWARF:336 debug_line:337 - Version: 4338 MinInstLength: 1339 MaxOpsPerInst: 1340 DefaultIsStmt: 1341 LineBase: 0342 LineRange: 0343 OpcodeBase: 1344 IncludeDirs: []345 346# TODO: Use yaml2obj for this test once it supports DWARFv5 line tables.347# RUN: echo '.file 0 "/dir" "dwarfv5.c"' | \348# RUN: llvm-mc -g -dwarf-version=5 -triple x86_64-pc-linux -filetype=obj \349# RUN: -o %t.dwarfv5.o350# RUN: llvm-dwarfdump --show-sources %t.dwarfv5.o | \351# RUN: FileCheck --check-prefix=DWARFV5 --match-full-lines \352# RUN: --implicit-check-not={{.}} %s353 354# DWARFV5: /dir{{[/\\]}}dwarfv5.c355 356# RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_malformed.s \357# RUN: -filetype=obj -o %t.malformed.o358# RUN: not llvm-dwarfdump --show-sources %t.malformed.o 2>&1 | \359# RUN: FileCheck --check-prefix=MALFORMED --match-full-lines \360# RUN: --implicit-check-not={{.}} %s361 362# MALFORMED: error: parsing line table prologue at offset 0x00000048: unsupported version 0363