brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · 13ab43f Raw
130 lines · plain
1; RUN: llc -split-dwarf-file=foo.dwo -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj > %t2; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s3; RUN: llvm-objdump -r %t | FileCheck --check-prefix=RELOCS %s4 5; Test the emission of gmlt-like inlining information into the skeleton unit.6; This allows inline-aware symbolication/backtracing given only the linked7; executable, without needing access to the .dwos.8 9; A simple example of inlining generated with clang -gsplit-dwarf10 11; A member function is used to force emission of the declaration of the12; 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 also14; tests the general case of context emission, which is suppressed in gmlt-like15; data.16 17; Include a template just to test template parameters are not emitted in18; 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't23; be emitted either.24 25; Minor complication: after generating the LLVM IR, it was manually edited so26; that the 'f1()' call from f3 was reordered to appear between the two inlined27; 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 brief53; descriptions of subprograms with inlined scopes.54 55; FIXME: Once tools support indexed addresses in the skeleton CU, we should use56; those (DW_FORM_addr would become DW_FORM_GNU_addr_index below) since those57; addresses will already be in the address pool anyway.58 59; CHECK:      DW_TAG_subprogram60; CHECK-NEXT:   DW_AT_name {{.*}} "f2<int>"61; CHECK-NEXT:   DW_AT_inline62; CHECK:      DW_TAG_subprogram63; CHECK-NEXT:   DW_AT_low_pc [DW_FORM_addr]64; CHECK-NEXT:   DW_AT_high_pc65; CHECK-NEXT:   DW_AT_name {{.*}} "f3"66; CHECK-NOT: {{DW_|NULL}}67; CHECK:        DW_TAG_inlined_subroutine68; CHECK-NEXT:     DW_AT_abstract_origin {{.*}} "f2<int>"69; CHECK-NEXT:     DW_AT_ranges70; CHECK-NOT: {{DW_AT|DW_TAG|NULL}}71; CHECK:     DW_AT_call_file72; CHECK-NEXT:     DW_AT_call_line {{.*}} (18)73; CHECK-NEXT:     DW_AT_call_column {{.*}} (5)74; CHECK:     DW_AT_call_file75; CHECK-NEXT:     DW_AT_call_line {{.*}} (21)76; CHECK-NOT: DW_77; CHECK: .debug_info.dwo contents:78 79; RELOCS-NOT: RELOCATION RECORDS FOR [.rela.debug_ranges]80 81; Function Attrs: uwtable82define void @_ZN3foo2f3Ez(...) #0 align 2 !dbg !10 {83entry:84  call void @_Z2f1v(), !dbg !2685  call void @_Z2f1v(), !dbg !2586  call void @_Z2f1v(), !dbg !2887  call void @_Z2f1v(), !dbg !2988  ret void, !dbg !2989}90 91declare void @_Z2f1v() #192 93attributes #0 = { uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }94attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }95 96!llvm.dbg.cu = !{!0}97!llvm.module.flags = !{!22, !23}98!llvm.ident = !{!24}99 100!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)101!1 = !DIFile(filename: "fission-inline.cpp", directory: "/tmp/dbginfo")102!2 = !{}103!3 = !{!4}104!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS3foo")105!5 = !{!6}106!6 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ez", line: 4, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !4, type: !7)107!7 = !DISubroutineType(types: !8)108!8 = !{null, null}109!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, retainedNodes: !18)110!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, retainedNodes: !2)111!12 = !DISubroutineType(types: !13)112!13 = !{null}113!14 = !{!15}114!15 = !DITemplateTypeParameter(name: "T", type: !16)115!16 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)116!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)117!18 = !{!19}118!19 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !1, line: 19, scope: !20, entity: !4)119!20 = distinct !DILexicalBlock(line: 16, column: 13, file: !1, scope: !21)120!21 = distinct !DILexicalBlock(line: 16, column: 7, file: !1, scope: !10)121!22 = !{i32 2, !"Dwarf Version", i32 4}122!23 = !{i32 2, !"Debug Info Version", i32 3}123!24 = !{!"clang version 3.6.0 "}124!25 = !DILocation(line: 17, column: 5, scope: !20)125!26 = !DILocation(line: 11, column: 3, scope: !11, inlinedAt: !27)126!27 = !DILocation(line: 18, column: 5, scope: !20)127!28 = !DILocation(line: 12, column: 3, scope: !11, inlinedAt: !27)128!29 = !DILocation(line: 12, column: 3, scope: !11, inlinedAt: !30)129!30 = !DILocation(line: 21, column: 0, scope: !10)130