blob: 9aacaca9c76deb9ff36c5f87334793ecdd1fb67a [file] [log] [blame]
David Blaikie96b1ed52017-04-21 23:35:26 +00001; RUN: llc -dwarf-version=4 -generate-type-units \
Paul Robinsoncddd6042017-02-28 20:24:55 +00002; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
Adrian Prantl16aa4cf2017-09-11 23:05:20 +00003; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-4
Paul Robinsoncddd6042017-02-28 20:24:55 +00004
David Blaikie96b1ed52017-04-21 23:35:26 +00005; RUN: llc -split-dwarf-file=foo.dwo -dwarf-version=4 -generate-type-units \
Paul Robinsoncddd6042017-02-28 20:24:55 +00006; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
Adrian Prantl16aa4cf2017-09-11 23:05:20 +00007; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SPLIT-4
Paul Robinsoncddd6042017-02-28 20:24:55 +00008
David Blaikie96b1ed52017-04-21 23:35:26 +00009; RUN: llc -dwarf-version=5 -generate-type-units \
Paul Robinsoncddd6042017-02-28 20:24:55 +000010; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
Adrian Prantl16aa4cf2017-09-11 23:05:20 +000011; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-5
Paul Robinsoncddd6042017-02-28 20:24:55 +000012
David Blaikie96b1ed52017-04-21 23:35:26 +000013; RUN: llc -split-dwarf-file=foo.dwo -dwarf-version=5 -generate-type-units \
Paul Robinsoncddd6042017-02-28 20:24:55 +000014; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
Adrian Prantl16aa4cf2017-09-11 23:05:20 +000015; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SPLIT-5
Paul Robinsoncddd6042017-02-28 20:24:55 +000016
17; Looking for DWARF headers to be generated correctly.
18; There are 7 variants: v4 CU, v4 TU, v5 (normal/skeleton/split) CU,
19; v5 (normal/split) TU. The v5 CU variants and TU variants differ
20; only in the type-unit code.
21; (v2 thru v4 CUs are all the same, and TUs were invented in v4,
22; so we don't bother checking older versions.)
23
24; Test case built from:
25;struct S {
26; int s1;
27;};
28;
29;S s;
30
31; Verify the v4 non-split headers.
32; Note that we check the exact offset of the DIEs because that tells us
33; the length of the header.
34;
35; SINGLE-4: .debug_info contents:
36; SINGLE-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004 abbr_offset
37; SINGLE-4: 0x0000000b: DW_TAG_compile_unit
38;
39; SINGLE-4: .debug_types contents:
40; SINGLE-4: 0x00000000: Type Unit: {{.*}} version = 0x0004 abbr_offset
41; SINGLE-4: 0x00000017: DW_TAG_type_unit
42
43; Verify the v4 split headers.
44;
45; SPLIT-4: .debug_info contents:
46; SPLIT-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004 abbr_offset
47; SPLIT-4: 0x0000000b: DW_TAG_compile_unit
48;
49; SPLIT-4: .debug_info.dwo contents:
50; SPLIT-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004 abbr_offset
51; SPLIT-4: 0x0000000b: DW_TAG_compile_unit
52;
53; SPLIT-4: .debug_types.dwo contents:
54; SPLIT-4: 0x00000000: Type Unit: {{.*}} version = 0x0004 abbr_offset
55; SPLIT-4: 0x00000017: DW_TAG_type_unit
56
57; Verify the v5 non-split headers.
58;
59; SINGLE-5: .debug_info contents:
60; SINGLE-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005 unit_type = DW_UT_compile abbr_offset
61; SINGLE-5: 0x0000000c: DW_TAG_compile_unit
62;
63; FIXME: V5 wants type units in .debug_info not .debug_types.
64; SINGLE-5: .debug_types contents:
65; SINGLE-5: 0x00000000: Type Unit: {{.*}} version = 0x0005 unit_type = DW_UT_type abbr_offset
66; SINGLE-5: 0x00000018: DW_TAG_type_unit
67
68; Verify the v5 split headers.
69;
70; SPLIT-5: .debug_info contents:
71; SPLIT-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005 unit_type = DW_UT_skeleton abbr_offset
72; SPLIT-5: 0x0000000c: DW_TAG_compile_unit
73;
74; SPLIT-5: .debug_info.dwo contents:
75; SPLIT-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005 unit_type = DW_UT_split_compile abbr_offset
76; SPLIT-5: 0x0000000c: DW_TAG_compile_unit
77;
78; FIXME: V5 wants type units in .debug_info.dwo not .debug_types.dwo.
79; SPLIT-5: .debug_types.dwo contents:
80; SPLIT-5: 0x00000000: Type Unit: {{.*}} version = 0x0005 unit_type = DW_UT_split_type abbr_offset
81; SPLIT-5: 0x00000018: DW_TAG_type_unit
82
83
84; ModuleID = 't.cpp'
85source_filename = "t.cpp"
86target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
87target triple = "x86_64-unknown-linux-gnu"
88
89%struct.S = type { i32 }
90
91@s = global %struct.S zeroinitializer, align 4, !dbg !0
92
93!llvm.dbg.cu = !{!2}
94!llvm.module.flags = !{!10, !11}
95!llvm.ident = !{!12}
96
Adrian Prantl05782212017-08-30 18:06:51 +000097!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
Paul Robinsoncddd6042017-02-28 20:24:55 +000098!1 = distinct !DIGlobalVariable(name: "s", scope: !2, file: !3, line: 5, type: !6, isLocal: false, isDefinition: true)
99!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)
100!3 = !DIFile(filename: "t.cpp", directory: "/home/probinson/projects/scratch")
101!4 = !{}
102!5 = !{!0}
103!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 1, size: 32, elements: !7, identifier: "_ZTS1S")
104!7 = !{!8}
105!8 = !DIDerivedType(tag: DW_TAG_member, name: "s1", scope: !6, file: !3, line: 2, baseType: !9, size: 32)
106!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
107!10 = !{i32 2, !"Dwarf Version", i32 4}
108!11 = !{i32 2, !"Debug Info Version", i32 3}
109!12 = !{!"clang version 5.0.0 (trunk 295942)"}