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