|
| 1 | +; RUN: llc -filetype=obj < %s -o - 2>&1 | llvm-readobj - --codeview | FileCheck %s |
| 2 | + |
| 3 | +; Check that when DISubprogram is attached to two functions, CodeView is |
| 4 | +; produced correctly. |
| 5 | + |
| 6 | +; CHECK: Subsection [ |
| 7 | +; CHECK: GlobalProcIdSym { |
| 8 | +; CHECK: Kind: S_GPROC32_ID (0x1147) |
| 9 | +; CHECK: FunctionType: foo (0x1002) |
| 10 | +; CHECK: CodeOffset: foo+0x0 |
| 11 | +; CHECK: Flags [ (0x80) |
| 12 | +; CHECK: HasOptimizedDebugInfo (0x80) |
| 13 | +; CHECK: ] |
| 14 | +; CHECK: DisplayName: foo |
| 15 | +; CHECK: LinkageName: foo |
| 16 | +; CHECK: } |
| 17 | +; CHECK: LocalSym { |
| 18 | +; CHECK: Kind: S_LOCAL (0x113E) |
| 19 | +; CHECK: Type: int (0x74) |
| 20 | +; CHECK: Flags [ (0x0) |
| 21 | +; CHECK: ] |
| 22 | +; CHECK: VarName: a |
| 23 | +; CHECK: } |
| 24 | +; CHECK: LocalSym { |
| 25 | +; CHECK: Kind: S_LOCAL (0x113E) |
| 26 | +; CHECK: Type: foo::bar (0x1005) |
| 27 | +; CHECK: Flags [ (0x0) |
| 28 | +; CHECK: ] |
| 29 | +; CHECK: VarName: c |
| 30 | +; CHECK: } |
| 31 | +; CHECK: UDTSym { |
| 32 | +; CHECK: Kind: S_UDT (0x1108) |
| 33 | +; CHECK: Type: foo::bar (0x1005) |
| 34 | +; CHECK: UDTName: foo::bar |
| 35 | +; CHECK: } |
| 36 | +; CHECK: ] |
| 37 | +; CHECK: Subsection [ |
| 38 | +; CHECK: GlobalProcIdSym { |
| 39 | +; CHECK: Kind: S_GPROC32_ID (0x1147) |
| 40 | +; CHECK: FunctionType: foo (0x1002) |
| 41 | +; CHECK: CodeOffset: foo_clone+0x0 |
| 42 | +; CHECK: Flags [ (0x80) |
| 43 | +; CHECK: HasOptimizedDebugInfo (0x80) |
| 44 | +; CHECK: ] |
| 45 | +; CHECK: DisplayName: foo |
| 46 | +; CHECK: LinkageName: foo_clone |
| 47 | +; CHECK: } |
| 48 | +; CHECK: LocalSym { |
| 49 | +; CHECK: Kind: S_LOCAL (0x113E) |
| 50 | +; CHECK: Type: int (0x74) |
| 51 | +; CHECK: Flags [ (0x0) |
| 52 | +; CHECK: ] |
| 53 | +; CHECK: VarName: a |
| 54 | +; CHECK: } |
| 55 | +; CHECK: LocalSym { |
| 56 | +; CHECK: Kind: S_LOCAL (0x113E) |
| 57 | +; CHECK: Type: foo::bar (0x1005) |
| 58 | +; CHECK: Flags [ (0x0) |
| 59 | +; CHECK: ] |
| 60 | +; CHECK: VarName: c |
| 61 | +; CHECK: } |
| 62 | +; CHECK: UDTSym { |
| 63 | +; CHECK: Kind: S_UDT (0x1108) |
| 64 | +; CHECK: Type: foo::bar (0x1005) |
| 65 | +; CHECK: UDTName: foo::bar |
| 66 | +; CHECK: } |
| 67 | +; CHECK: ] |
| 68 | + |
| 69 | +; ModuleID = 'shared-sp.ll' |
| 70 | +target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 71 | +target triple = "x86_64-pc-windows-msvc19.29.30133" |
| 72 | + |
| 73 | +!0 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !2, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !4, retainedNodes: !{}) |
| 74 | +!1 = !DIFile(filename: "example.c", directory: "/") |
| 75 | +!2 = !DISubroutineType(types: !3) |
| 76 | +!3 = !{!5} |
| 77 | +!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug) |
| 78 | +!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 79 | + |
| 80 | +; Local variable. |
| 81 | +!10 = !DILocalVariable(name: "a", scope: !0, file: !1, line: 2, type: !5) |
| 82 | + |
| 83 | +; DICompositeType local to foo. |
| 84 | +!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "bar", scope: !0, file: !1, line: 2, size: 32, elements: !12) |
| 85 | +!12 = !{!13} |
| 86 | +!13 = !DIDerivedType(tag: DW_TAG_member, name: "m", scope: !11, file: !1, line: 2, baseType: !5, size: 32) |
| 87 | + |
| 88 | +; Local variable of type struct bar, local to foo. |
| 89 | +!14 = !DILocalVariable(name: "c", scope: !0, file: !1, line: 2, type: !11) |
| 90 | + |
| 91 | +!101 = !DILocation(line: 2, column: 5, scope: !0) |
| 92 | +!102 = !DILocation(line: 3, column: 1, scope: !0) |
| 93 | +!103 = !DILocation(line: 2, column: 12, scope: !0) |
| 94 | + |
| 95 | +!llvm.dbg.cu = !{!4} |
| 96 | +!llvm.module.flags = !{!29, !30} |
| 97 | + |
| 98 | +!29 = !{i32 2, !"CodeView", i32 1} |
| 99 | +!30 = !{i32 2, !"Debug Info Version", i32 3} |
| 100 | + |
| 101 | +define i32 @foo() !dbg !0 { |
| 102 | +entry: |
| 103 | + ; Local variable 'a' debug info. |
| 104 | + %a.addr = alloca i32, align 4, !dbg !101 |
| 105 | + #dbg_declare(ptr %a.addr, !10, !DIExpression(), !101) |
| 106 | + store i32 42, ptr %a.addr, align 4, !dbg !101 |
| 107 | + |
| 108 | + ; Local variable 'c' (struct bar) debug info. |
| 109 | + %c.addr = alloca %struct.bar, align 4, !dbg !103 |
| 110 | + #dbg_declare(ptr %c.addr, !14, !DIExpression(), !103) |
| 111 | + |
| 112 | + ret i32 42, !dbg !102 |
| 113 | +} |
| 114 | + |
| 115 | +define i32 @foo_clone() !dbg !0 { |
| 116 | +entry: |
| 117 | + ; Local variable 'a' debug info. |
| 118 | + %a.addr = alloca i32, align 4, !dbg !101 |
| 119 | + #dbg_declare(ptr %a.addr, !10, !DIExpression(), !101) |
| 120 | + store i32 42, ptr %a.addr, align 4, !dbg !101 |
| 121 | + |
| 122 | + ; Local variable 'c' (struct bar) debug info. |
| 123 | + %c.addr = alloca %struct.bar, align 4, !dbg !103 |
| 124 | + #dbg_declare(ptr %c.addr, !14, !DIExpression(), !103) |
| 125 | + |
| 126 | + ret i32 42, !dbg !102 |
| 127 | +} |
| 128 | + |
| 129 | +%struct.bar = type { i32 } |
0 commit comments