Jyotsna Verma | 9dea095 | 2013-04-10 19:53:26 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | |
Peter Collingbourne | 876da02 | 2017-09-12 21:50:55 +0000 | [diff] [blame^] | 3 | ; RUN: %llc_dwarf -debugger-tune=gdb -filetype=obj -o %t.o < %s |
Adrian Prantl | 7bc1b28 | 2017-09-11 22:59:45 +0000 | [diff] [blame] | 4 | ; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck %s |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 5 | ; ModuleID = 'dwarf-public-names.cpp' |
| 6 | ; |
| 7 | ; Generated from: |
| 8 | ; |
| 9 | ; struct C { |
| 10 | ; void member_function(); |
| 11 | ; static int static_member_function(); |
| 12 | ; static int static_member_variable; |
| 13 | ; }; |
| 14 | ; |
| 15 | ; int C::static_member_variable = 0; |
| 16 | ; |
| 17 | ; void C::member_function() { |
| 18 | ; static_member_variable = 0; |
| 19 | ; } |
| 20 | ; |
| 21 | ; int C::static_member_function() { |
| 22 | ; return static_member_variable; |
| 23 | ; } |
| 24 | ; |
| 25 | ; C global_variable; |
| 26 | ; |
| 27 | ; int global_function() { |
| 28 | ; return -1; |
| 29 | ; } |
| 30 | ; |
| 31 | ; namespace ns { |
| 32 | ; void global_namespace_function() { |
| 33 | ; global_variable.member_function(); |
| 34 | ; } |
| 35 | ; int global_namespace_variable = 1; |
| 36 | ; } |
| 37 | |
| 38 | ; Skip the output to the header of the pubnames section. |
| 39 | ; CHECK: debug_pubnames |
David Blaikie | eed309d | 2014-11-01 23:42:30 +0000 | [diff] [blame] | 40 | ; CHECK: version = 0x0002 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 41 | |
| 42 | ; Check for each name in the output. |
David Blaikie | 553eb4a | 2014-06-06 22:16:56 +0000 | [diff] [blame] | 43 | ; CHECK-DAG: "ns" |
David Blaikie | 3dca599 | 2014-06-06 22:29:05 +0000 | [diff] [blame] | 44 | ; CHECK-DAG: "C::static_member_function" |
David Blaikie | 553eb4a | 2014-06-06 22:16:56 +0000 | [diff] [blame] | 45 | ; CHECK-DAG: "global_variable" |
| 46 | ; CHECK-DAG: "ns::global_namespace_variable" |
| 47 | ; CHECK-DAG: "ns::global_namespace_function" |
| 48 | ; CHECK-DAG: "global_function" |
| 49 | ; CHECK-DAG: "C::static_member_variable" |
David Blaikie | 3dca599 | 2014-06-06 22:29:05 +0000 | [diff] [blame] | 50 | ; CHECK-DAG: "C::member_function" |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 51 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 52 | source_filename = "test/DebugInfo/Generic/dwarf-public-names.ll" |
| 53 | |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 54 | %struct.C = type { i8 } |
| 55 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 56 | @_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0 |
| 57 | @global_variable = global %struct.C zeroinitializer, align 1, !dbg !15 |
| 58 | @_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 59 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 60 | ; Function Attrs: nounwind uwtable |
| 61 | define void @_ZN1C15member_functionEv(%struct.C* %this) #0 align 2 !dbg !23 { |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 62 | entry: |
| 63 | %this.addr = alloca %struct.C*, align 8 |
| 64 | store %struct.C* %this, %struct.C** %this.addr, align 8 |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 65 | call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !24, metadata !26), !dbg !27 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 66 | %this1 = load %struct.C*, %struct.C** %this.addr |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 67 | store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !28 |
| 68 | ret void, !dbg !29 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 69 | } |
| 70 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 71 | ; Function Attrs: nounwind readnone |
| 72 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 73 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 74 | ; Function Attrs: nounwind uwtable |
| 75 | define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 { |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 76 | entry: |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 77 | %0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31 |
| 78 | ret i32 %0, !dbg !31 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 79 | } |
| 80 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 81 | ; Function Attrs: nounwind uwtable |
| 82 | define i32 @_Z15global_functionv() #0 !dbg !32 { |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 83 | entry: |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 84 | ret i32 -1, !dbg !33 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 85 | } |
| 86 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 87 | ; Function Attrs: nounwind uwtable |
| 88 | define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 { |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 89 | entry: |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 90 | call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !37 |
| 91 | ret void, !dbg !38 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | attributes #0 = { nounwind uwtable } |
| 95 | attributes #1 = { nounwind readnone } |
| 96 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 97 | !llvm.dbg.cu = !{!20} |
| 98 | !llvm.module.flags = !{!22} |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 99 | |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 100 | !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 101 | !1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5) |
| 102 | !2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, align: 8, elements: !4) |
| 103 | !3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") |
| 104 | !4 = !{!5, !7, !12} |
| 105 | !5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember) |
| 106 | !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 107 | !7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, variables: !11) |
| 108 | !8 = !DISubroutineType(types: !9) |
| 109 | !9 = !{null, !10} |
| 110 | !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 111 | !11 = !{} |
| 112 | !12 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: !2, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, variables: !11) |
| 113 | !13 = !DISubroutineType(types: !14) |
| 114 | !14 = !{!6} |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 115 | !15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 116 | !16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 117 | !17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 118 | !18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true) |
Adrian Prantl | fed4f39 | 2017-04-28 22:25:46 +0000 | [diff] [blame] | 119 | !19 = !DINamespace(name: "ns", scope: null) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 120 | !20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type |
| 121 | !21 = !{!0, !15, !17} |
| 122 | !22 = !{i32 1, !"Debug Info Version", i32 3} |
| 123 | !23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, variables: !11) |
| 124 | !24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 125 | !25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64) |
| 126 | !26 = !DIExpression() |
| 127 | !27 = !DILocation(line: 9, scope: !23) |
| 128 | !28 = !DILocation(line: 10, scope: !23) |
| 129 | !29 = !DILocation(line: 11, scope: !23) |
| 130 | !30 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: null, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !12, variables: !11) |
| 131 | !31 = !DILocation(line: 14, scope: !30) |
| 132 | !32 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", scope: !3, file: !3, line: 19, type: !13, isLocal: false, isDefinition: true, scopeLine: 19, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, variables: !11) |
| 133 | !33 = !DILocation(line: 20, scope: !32) |
| 134 | !34 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", scope: !19, file: !3, line: 24, type: !35, isLocal: false, isDefinition: true, scopeLine: 24, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, variables: !11) |
| 135 | !35 = !DISubroutineType(types: !36) |
| 136 | !36 = !{null} |
| 137 | !37 = !DILocation(line: 25, scope: !34) |
| 138 | !38 = !DILocation(line: 26, scope: !34) |
| 139 | |