blob: 29c770db3b80044fb4c993527c10d15a53cab699 [file] [log] [blame]
David Blaikie3a443c22014-11-04 22:12:25 +00001; RUN: llc -split-dwarf=Enable -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
2
3; Test the emission of gmlt-like inlining information into the skeleton unit.
4; This allows inline-aware symbolication/backtracing given only the linked
5; executable, without needing access to the .dwos.
6
7; A simple example of inlining generated with clang -gsplit-dwarf
8
9; A member function is used to force emission of the declaration of the
10; function into the .dwo file, which may be shared with other CUs in the dwo ;
11; under fission, but should not be shared with the skeleton's CU. This also
12; tests the general case of context emission, which is suppressed in gmlt-like
13; data.
14
15; Include a template just to test template parameters are not emitted in
16; gmlt-like data.
17
18; And some varargs to make sure DW_TAG_unspecified_parameters is not emitted.
19
20; And a using declaration in a nested lexical_block... because that shouldn't
21; be emitted either.
22
23; Minor complication: after generating the LLVM IR, it was manually edited so
24; that the 'f1()' call from f3 was reordered to appear between the two inlined
25; f1 calls from f2. This causes f2's inlined_subroutine to use DW_AT_ranges,
26; thus exercising range list generation/referencing which was buggy.
27
28; struct foo {
29; template<typename T>
30; static void f2();
31; static void f3(...);
32; };
33;
34; void f1();
35;
36; template<typename T>
37; inline __attribute__((always_inline)) void foo::f2() {
38; f1();
39; f1();
40; }
41;
42; void foo::f3(...) {
43; if (true) {
44; f1();
45; f2<int>();
46; using ::foo;
47; }
48; }
49
50; Check that we emit the usual gmlt-like data for this file, including brief
51; descriptions of subprograms with inlined scopes.
52
53; FIXME: Once tools support indexed addresses in the skeleton CU, we should use
54; those (DW_FORM_addr would become DW_FORM_GNU_addr_index below) since those
55; addresses will already be in the address pool anyway.
56
57; CHECK: DW_TAG_subprogram
58; CHECK-NEXT: DW_AT_name {{.*}} "f2<int>"
59; CHECK-NOT: DW_
60; CHECK: DW_TAG_subprogram
61; CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]
62; CHECK-NEXT: DW_AT_high_pc
63; CHECK-NEXT: DW_AT_name {{.*}} "f3"
64; CHECK-NOT: {{DW_|NULL}}
65; CHECK: DW_TAG_inlined_subroutine
66; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "f2<int>"
67; CHECK-NEXT: DW_AT_ranges
68; CHECK-NEXT: DW_AT_call_file
69; CHECK-NEXT: DW_AT_call_line {{.*}} (18)
70; CHECK-NOT: DW_
71
72; Function Attrs: uwtable
73define void @_ZN3foo2f3Ez(...) #0 align 2 {
74entry:
75 call void @_Z2f1v(), !dbg !26
76 call void @_Z2f1v(), !dbg !25
77 call void @_Z2f1v(), !dbg !28
78 ret void, !dbg !29
79}
80
81declare void @_Z2f1v() #1
82
83attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
84attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
85
86!llvm.dbg.cu = !{!0}
87!llvm.module.flags = !{!22, !23}
88!llvm.ident = !{!24}
89
90!0 = metadata !{metadata !"0x11\004\00clang version 3.6.0 \000\00\000\00fission-inline.dwo\001", metadata !1, metadata !2, metadata !3, metadata !9, metadata !2, metadata !18} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/fission-inline.cpp] [DW_LANG_C_plus_plus]
91!1 = metadata !{metadata !"fission-inline.cpp", metadata !"/tmp/dbginfo"}
92!2 = metadata !{}
93!3 = metadata !{metadata !4}
94!4 = metadata !{metadata !"0x13\00foo\001\008\008\000\000\000", metadata !1, null, null, metadata !5, null, null, metadata !"_ZTS3foo"} ; [ DW_TAG_structure_type ] [foo] [line 1, size 8, align 8, offset 0] [def] [from ]
95!5 = metadata !{metadata !6}
96!6 = metadata !{metadata !"0x2e\00f3\00f3\00_ZN3foo2f3Ez\004\000\000\000\000\00256\000\004", metadata !1, metadata !"_ZTS3foo", metadata !7, null, null, null, null, null} ; [ DW_TAG_subprogram ] [line 4] [f3]
97!7 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", null, null, null, metadata !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
98!8 = metadata !{null, null}
99!9 = metadata !{metadata !10, metadata !11}
100!10 = metadata !{metadata !"0x2e\00f3\00f3\00_ZN3foo2f3Ez\0015\000\001\000\000\00256\000\0015", metadata !1, metadata !"_ZTS3foo", metadata !7, null, void (...)* @_ZN3foo2f3Ez, null, metadata !6, metadata !2} ; [ DW_TAG_subprogram ] [line 15] [def] [f3]
101!11 = metadata !{metadata !"0x2e\00f2<int>\00f2<int>\00_ZN3foo2f2IiEEvv\0010\000\001\000\000\00256\000\0010", metadata !1, metadata !"_ZTS3foo", metadata !12, null, null, metadata !14, metadata !17, metadata !2} ; [ DW_TAG_subprogram ] [line 10] [def] [f2<int>]
102!12 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", null, null, null, metadata !13, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
103!13 = metadata !{null}
104!14 = metadata !{metadata !15}
105!15 = metadata !{metadata !"0x2f\00T\000\000", null, metadata !16, null} ; [ DW_TAG_template_type_parameter ]
106!16 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
107!17 = metadata !{metadata !"0x2e\00f2<int>\00f2<int>\00_ZN3foo2f2IiEEvv\0010\000\000\000\000\00256\000\0010", metadata !1, metadata !"_ZTS3foo", metadata !12, null, null, metadata !14, null, null} ; [ DW_TAG_subprogram ] [line 10] [f2<int>]
108!18 = metadata !{metadata !19}
109!19 = metadata !{metadata !"0x8\0019\00", metadata !20, metadata !"_ZTS3foo"} ; [ DW_TAG_imported_declaration ]
110!20 = metadata !{metadata !"0xb\0016\0013\001", metadata !1, metadata !21} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/fission-inline.cpp]
111!21 = metadata !{metadata !"0xb\0016\007\000", metadata !1, metadata !10} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/fission-inline.cpp]
112!22 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
113!23 = metadata !{i32 2, metadata !"Debug Info Version", i32 2}
114!24 = metadata !{metadata !"clang version 3.6.0 "}
115!25 = metadata !{i32 17, i32 5, metadata !20, null}
116!26 = metadata !{i32 11, i32 3, metadata !11, metadata !27}
117!27 = metadata !{i32 18, i32 5, metadata !20, null}
118!28 = metadata !{i32 12, i32 3, metadata !11, metadata !27}
119!29 = metadata !{i32 21, i32 1, metadata !10, null}