1*9880d681SAndroid Build Coastguard Worker; RUN: llc -split-dwarf=Enable -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj > %t 2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker; RUN: llvm-objdump -r %t | FileCheck --check-prefix=RELOCS %s 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; Test the emission of gmlt-like inlining information into the skeleton unit. 6*9880d681SAndroid Build Coastguard Worker; This allows inline-aware symbolication/backtracing given only the linked 7*9880d681SAndroid Build Coastguard Worker; executable, without needing access to the .dwos. 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; A simple example of inlining generated with clang -gsplit-dwarf 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard Worker; A member function is used to force emission of the declaration of the 12*9880d681SAndroid Build Coastguard Worker; function into the .dwo file, which may be shared with other CUs in the dwo ; 13*9880d681SAndroid Build Coastguard Worker; under fission, but should not be shared with the skeleton's CU. This also 14*9880d681SAndroid Build Coastguard Worker; tests the general case of context emission, which is suppressed in gmlt-like 15*9880d681SAndroid Build Coastguard Worker; data. 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker; Include a template just to test template parameters are not emitted in 18*9880d681SAndroid Build Coastguard Worker; gmlt-like data. 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; And some varargs to make sure DW_TAG_unspecified_parameters is not emitted. 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker; And a using declaration in a nested lexical_block... because that shouldn't 23*9880d681SAndroid Build Coastguard Worker; be emitted either. 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker; Minor complication: after generating the LLVM IR, it was manually edited so 26*9880d681SAndroid Build Coastguard Worker; that the 'f1()' call from f3 was reordered to appear between the two inlined 27*9880d681SAndroid Build Coastguard Worker; f1 calls from f2. This causes f2's inlined_subroutine to use DW_AT_ranges, 28*9880d681SAndroid Build Coastguard Worker; thus exercising range list generation/referencing which was buggy. 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker; struct foo { 31*9880d681SAndroid Build Coastguard Worker; template<typename T> 32*9880d681SAndroid Build Coastguard Worker; static void f2(); 33*9880d681SAndroid Build Coastguard Worker; static void f3(...); 34*9880d681SAndroid Build Coastguard Worker; }; 35*9880d681SAndroid Build Coastguard Worker; 36*9880d681SAndroid Build Coastguard Worker; void f1(); 37*9880d681SAndroid Build Coastguard Worker; 38*9880d681SAndroid Build Coastguard Worker; template<typename T> 39*9880d681SAndroid Build Coastguard Worker; inline __attribute__((always_inline)) void foo::f2() { 40*9880d681SAndroid Build Coastguard Worker; f1(); 41*9880d681SAndroid Build Coastguard Worker; f1(); 42*9880d681SAndroid Build Coastguard Worker; } 43*9880d681SAndroid Build Coastguard Worker; 44*9880d681SAndroid Build Coastguard Worker; void foo::f3(...) { 45*9880d681SAndroid Build Coastguard Worker; if (true) { 46*9880d681SAndroid Build Coastguard Worker; f1(); 47*9880d681SAndroid Build Coastguard Worker; f2<int>(); 48*9880d681SAndroid Build Coastguard Worker; using ::foo; 49*9880d681SAndroid Build Coastguard Worker; } 50*9880d681SAndroid Build Coastguard Worker; } 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Worker; Check that we emit the usual gmlt-like data for this file, including brief 53*9880d681SAndroid Build Coastguard Worker; descriptions of subprograms with inlined scopes. 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker; FIXME: Once tools support indexed addresses in the skeleton CU, we should use 56*9880d681SAndroid Build Coastguard Worker; those (DW_FORM_addr would become DW_FORM_GNU_addr_index below) since those 57*9880d681SAndroid Build Coastguard Worker; addresses will already be in the address pool anyway. 58*9880d681SAndroid Build Coastguard Worker 59*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram 60*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_name {{.*}} "f2<int>" 61*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_ 62*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram 63*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] 64*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_high_pc 65*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_name {{.*}} "f3" 66*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_|NULL}} 67*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_inlined_subroutine 68*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "f2<int>" 69*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_ranges 70*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_AT|DW_TAG|NULL}} 71*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_call_file 72*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_call_line {{.*}} (18) 73*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_ 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Worker; RELOCS-NOT: RELOCATION RECORDS FOR [.rela.debug_ranges] 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable 78*9880d681SAndroid Build Coastguard Workerdefine void @_ZN3foo2f3Ez(...) #0 align 2 !dbg !10 { 79*9880d681SAndroid Build Coastguard Workerentry: 80*9880d681SAndroid Build Coastguard Worker call void @_Z2f1v(), !dbg !26 81*9880d681SAndroid Build Coastguard Worker call void @_Z2f1v(), !dbg !25 82*9880d681SAndroid Build Coastguard Worker call void @_Z2f1v(), !dbg !28 83*9880d681SAndroid Build Coastguard Worker ret void, !dbg !29 84*9880d681SAndroid Build Coastguard Worker} 85*9880d681SAndroid Build Coastguard Worker 86*9880d681SAndroid Build Coastguard Workerdeclare void @_Z2f1v() #1 87*9880d681SAndroid Build Coastguard Worker 88*9880d681SAndroid Build Coastguard Workerattributes #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" } 89*9880d681SAndroid Build Coastguard Workerattributes #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" } 90*9880d681SAndroid Build Coastguard Worker 91*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 92*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!22, !23} 93*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!24} 94*9880d681SAndroid Build Coastguard Worker 95*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, splitDebugFilename: "fission-inline.dwo", emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !18) 96*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "fission-inline.cpp", directory: "/tmp/dbginfo") 97*9880d681SAndroid Build Coastguard Worker!2 = !{} 98*9880d681SAndroid Build Coastguard Worker!3 = !{!4} 99*9880d681SAndroid Build Coastguard Worker!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS3foo") 100*9880d681SAndroid Build Coastguard Worker!5 = !{!6} 101*9880d681SAndroid Build Coastguard Worker!6 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ez", line: 4, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !4, type: !7) 102*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8) 103*9880d681SAndroid Build Coastguard Worker!8 = !{null, null} 104*9880d681SAndroid Build Coastguard Worker!10 = distinct !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ez", line: 15, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 15, file: !1, scope: !4, type: !7, declaration: !6, variables: !2) 105*9880d681SAndroid Build Coastguard Worker!11 = distinct !DISubprogram(name: "f2<int>", linkageName: "_ZN3foo2f2IiEEvv", line: 10, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 10, file: !1, scope: !4, type: !12, templateParams: !14, declaration: !17, variables: !2) 106*9880d681SAndroid Build Coastguard Worker!12 = !DISubroutineType(types: !13) 107*9880d681SAndroid Build Coastguard Worker!13 = !{null} 108*9880d681SAndroid Build Coastguard Worker!14 = !{!15} 109*9880d681SAndroid Build Coastguard Worker!15 = !DITemplateTypeParameter(name: "T", type: !16) 110*9880d681SAndroid Build Coastguard Worker!16 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 111*9880d681SAndroid Build Coastguard Worker!17 = !DISubprogram(name: "f2<int>", linkageName: "_ZN3foo2f2IiEEvv", line: 10, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 10, file: !1, scope: !4, type: !12, templateParams: !14) 112*9880d681SAndroid Build Coastguard Worker!18 = !{!19} 113*9880d681SAndroid Build Coastguard Worker!19 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 19, scope: !20, entity: !4) 114*9880d681SAndroid Build Coastguard Worker!20 = distinct !DILexicalBlock(line: 16, column: 13, file: !1, scope: !21) 115*9880d681SAndroid Build Coastguard Worker!21 = distinct !DILexicalBlock(line: 16, column: 7, file: !1, scope: !10) 116*9880d681SAndroid Build Coastguard Worker!22 = !{i32 2, !"Dwarf Version", i32 4} 117*9880d681SAndroid Build Coastguard Worker!23 = !{i32 2, !"Debug Info Version", i32 3} 118*9880d681SAndroid Build Coastguard Worker!24 = !{!"clang version 3.6.0 "} 119*9880d681SAndroid Build Coastguard Worker!25 = !DILocation(line: 17, column: 5, scope: !20) 120*9880d681SAndroid Build Coastguard Worker!26 = !DILocation(line: 11, column: 3, scope: !11, inlinedAt: !27) 121*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 18, column: 5, scope: !20) 122*9880d681SAndroid Build Coastguard Worker!28 = !DILocation(line: 12, column: 3, scope: !11, inlinedAt: !27) 123*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 21, column: 1, scope: !10) 124