1 ; RUN: llc -dwarf-version=4 -generate-type-units \ 2 ; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \ 3 ; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-4 4 5 ; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \ 6 ; RUN: -dwarf-version=4 -generate-type-units \ 7 ; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \ 8 ; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-4 9 ; RUN: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-4 10 11 ; RUN: llc -dwarf-version=5 -generate-type-units \ 12 ; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \ 13 ; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-5 14 15 ; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \ 16 ; RUN: -dwarf-version=5 -generate-type-units \ 17 ; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \ 18 ; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-5 19 ; RUN: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-5 20 21 ; Looking for DWARF headers to be generated correctly. 22 ; There are 8 variants with 5 formats: v4 CU, v4 TU, v5 normal/partial CU, 23 ; v5 skeleton/split CU, v5 normal/split TU. Some v5 variants differ only 24 ; in the unit_type code, and the skeleton/split CU differs from normal/partial 25 ; by having one extra field (dwo_id). 26 ; (v2 thru v4 CUs are all the same, and TUs were invented in v4, 27 ; so we don't bother checking older versions.) 28 29 ; Test case built from: 30 ;struct S { 31 ; int s1; 32 ;}; 33 ; 34 ;S s; 35 36 ; Verify the v4 non-split headers. 37 ; Note that we check the exact offset of the DIEs because that tells us 38 ; the length of the header. 39 ; 40 ; SINGLE-4: .debug_info contents: 41 ; SINGLE-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004 abbr_offset 42 ; SINGLE-4: 0x0000000b: DW_TAG_compile_unit 43 ; 44 ; SINGLE-4: .debug_types contents: 45 ; SINGLE-4: 0x00000000: Type Unit: {{.*}} version = 0x0004 abbr_offset 46 ; SINGLE-4: 0x00000017: DW_TAG_type_unit 47 48 ; Verify the v4 split headers. 49 ; 50 ; O-4: .debug_info contents: 51 ; O-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004 abbr_offset 52 ; O-4: 0x0000000b: DW_TAG_compile_unit 53 ; 54 ; DWO-4: .debug_info.dwo contents: 55 ; DWO-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004 abbr_offset 56 ; DWO-4: 0x0000000b: DW_TAG_compile_unit 57 ; 58 ; DWO-4: .debug_types.dwo contents: 59 ; DWO-4: 0x00000000: Type Unit: {{.*}} version = 0x0004 abbr_offset 60 ; DWO-4: 0x00000017: DW_TAG_type_unit 61 62 ; Verify the v5 non-split headers. 63 ; 64 ; SINGLE-5: .debug_info contents: 65 ; SINGLE-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005 unit_type = DW_UT_compile abbr_offset 66 ; SINGLE-5: 0x0000000c: DW_TAG_compile_unit 67 ; 68 ; FIXME: V5 wants type units in .debug_info not .debug_types. 69 ; SINGLE-5: .debug_types contents: 70 ; SINGLE-5: 0x00000000: Type Unit: {{.*}} version = 0x0005 unit_type = DW_UT_type abbr_offset 71 ; SINGLE-5: 0x00000018: DW_TAG_type_unit 72 73 ; Verify the v5 split headers. 74 ; 75 ; O-5: .debug_info contents: 76 ; O-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005 unit_type = DW_UT_skeleton abbr_offset 77 ; O-5-SAME: DWO_id = 0x4ed74084f749d96b 78 ; O-5: 0x00000014: DW_TAG_compile_unit 79 ; 80 ; DWO-5: .debug_info.dwo contents: 81 ; DWO-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005 unit_type = DW_UT_split_compile abbr_offset 82 ; DWO-5-SAME: DWO_id = 0x4ed74084f749d96b 83 ; DWO-5: 0x00000014: DW_TAG_compile_unit 84 ; 85 ; FIXME: V5 wants type units in .debug_info.dwo not .debug_types.dwo. 86 ; DWO-5: .debug_types.dwo contents: 87 ; DWO-5: 0x00000000: Type Unit: {{.*}} version = 0x0005 unit_type = DW_UT_split_type abbr_offset 88 ; DWO-5: 0x00000018: DW_TAG_type_unit 89 90 91 ; ModuleID = 't.cpp' 92 source_filename = "t.cpp" 93 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 94 target triple = "x86_64-unknown-linux-gnu" 95 96 %struct.S = type { i32 } 97 98 @s = global %struct.S zeroinitializer, align 4, !dbg !0 99 100 !llvm.dbg.cu = !{!2} 101 !llvm.module.flags = !{!10, !11} 102 !llvm.ident = !{!12} 103 104 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 105 !1 = distinct !DIGlobalVariable(name: "s", scope: !2, file: !3, line: 5, type: !6, isLocal: false, isDefinition: true) 106 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 295942)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 107 !3 = !DIFile(filename: "t.cpp", directory: "/home/probinson/projects/scratch") 108 !4 = !{} 109 !5 = !{!0} 110 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 1, size: 32, elements: !7, identifier: "_ZTS1S") 111 !7 = !{!8} 112 !8 = !DIDerivedType(tag: DW_TAG_member, name: "s1", scope: !6, file: !3, line: 2, baseType: !9, size: 32) 113 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 114 !10 = !{i32 2, !"Dwarf Version", i32 4} 115 !11 = !{i32 2, !"Debug Info Version", i32 3} 116 !12 = !{!"clang version 5.0.0 (trunk 295942)"} 117