xref: /llvm-project/llvm/test/MC/AArch64/coff-debug.ll (revision f8499d5709e37b4e9a6d2a39c385cfd2c00bad6e)
1; RUN: llc -mtriple=aarch64-windows -filetype=obj -o - %s | \
2; RUN: llvm-readobj --codeview - | FileCheck %s --check-prefixes=CHECK,CHECK-STDOUT
3; RUN: llc -mtriple=aarch64-windows -filetype=obj -o %t.o %s
4; RUN: llvm-readobj --codeview %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-FILE
5
6; ModuleID = 'a.c'
7source_filename = "a.c"
8target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
9target triple = "aarch64--windows-msvc18.0.0"
10
11; Function Attrs: noinline nounwind optnone
12define i32 @main() #0 !dbg !7 {
13entry:
14  %retval = alloca i32, align 4
15  store i32 0, ptr %retval, align 4
16  ret i32 1, !dbg !11
17}
18
19attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
20
21!llvm.dbg.cu = !{!0}
22!llvm.module.flags = !{!3, !4, !5}
23!llvm.ident = !{!6}
24
25!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
26!1 = !DIFile(filename: "a.c", directory: "/", checksumkind: CSK_MD5, checksum: "12345678901234567890123456789012")
27!2 = !{}
28!3 = !{i32 2, !"CodeView", i32 1}
29!4 = !{i32 2, !"Debug Info Version", i32 3}
30!5 = !{i32 1, !"wchar_size", i32 2}
31!6 = !{!"clang"}
32!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2)
33!8 = !DISubroutineType(types: !9)
34!9 = !{!10}
35!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
36!11 = !DILocation(line: 2, column: 3, scope: !7)
37
38; CHECK: Format: COFF-ARM64
39; CHECK: Arch: aarch64
40; CHECK: AddressSize: 64bit
41; CHECK: CodeViewTypes [
42; CHECK:   Section: .debug$T (5)
43; CHECK:   Magic: 0x4
44; CHECK:   ArgList (0x1000) {
45; CHECK:     TypeLeafKind: LF_ARGLIST (0x1201)
46; CHECK:     NumArgs: 0
47; CHECK:     Arguments [
48; CHECK:     ]
49; CHECK:   }
50; CHECK:   Procedure (0x1001) {
51; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
52; CHECK:     ReturnType: int (0x74)
53; CHECK:     CallingConvention: NearC (0x0)
54; CHECK:     FunctionOptions [ (0x0)
55; CHECK:     ]
56; CHECK:     NumParameters: 0
57; CHECK:     ArgListType: () (0x1000)
58; CHECK:   }
59; CHECK:   FuncId (0x1002) {
60; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
61; CHECK:     ParentScope: 0x0
62; CHECK:     FunctionType: int () (0x1001)
63; CHECK:     Name: main
64; CHECK:   }
65; CHECK: ]
66; CHECK: CodeViewDebugInfo [
67; CHECK:   Section: .debug$S (4)
68; CHECK:   Magic: 0x4
69; CHECK:   Subsection [
70; CHECK:     SubSectionType: Symbols (0xF1)
71; CHECK:     ObjNameSym {
72; CHECK:       Kind: S_OBJNAME (0x1101)
73; CHECK:       Signature: 0x0
74; CHECK-STDOUT: ObjectName: {{$}}
75; CHECK-FILE:   ObjectName: {{.*}}.o
76; CHECK:     }
77; CHECK:     Compile3Sym {
78; CHECK:       Kind: S_COMPILE3 (0x113C)
79; CHECK:       Language: C (0x0)
80; CHECK:       Flags [ (0x4000
81; CHECK:        HotPatch (0x4000)
82; CHECK:       ]
83; CHECK:     }
84; CHECK:   ]
85; CHECK:   Subsection [
86; CHECK:     SubSectionType: Symbols (0xF1)
87; CHECK:     GlobalProcIdSym {
88; CHECK:       Kind: S_GPROC32_ID (0x1147)
89; CHECK:       PtrParent: 0x0
90; CHECK:       PtrEnd: 0x0
91; CHECK:       PtrNext: 0x0
92; CHECK:       CodeSize: 0x14
93; CHECK:       DbgStart: 0x0
94; CHECK:       DbgEnd: 0x0
95; CHECK:       FunctionType: main (0x1002)
96; CHECK:       CodeOffset: main+0x0
97; CHECK:       Segment: 0x0
98; CHECK:       Flags [ (0xC0)
99; CHECK:         HasOptimizedDebugInfo (0x80)
100; CHECK:         IsNoInline (0x40)
101; CHECK:       ]
102; CHECK:       DisplayName: main
103; CHECK:       LinkageName: main
104; CHECK:     }
105; CHECK:     ProcEnd {
106; CHECK:       Kind: S_PROC_ID_END (0x114F)
107; CHECK:     }
108; CHECK:   ]
109; CHECK:   Subsection [
110; CHECK:     SubSectionType: Lines (0xF2)
111; CHECK:     LinkageName: main
112; CHECK:   ]
113; CHECK:   Subsection [
114; CHECK:     SubSectionType: FileChecksums (0xF4)
115; CHECK:     FileChecksum {
116; CHECK:       ChecksumSize: 0x10
117; CHECK:       ChecksumKind: MD5 (0x1)
118; CHECK:       ChecksumBytes: (12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 12)
119; CHECK:     }
120; CHECK:   ]
121; CHECK:   Subsection [
122; CHECK:     SubSectionType: StringTable (0xF3)
123; CHECK:   ]
124; CHECK:   FunctionLineTable [
125; CHECK:     LinkageName: main
126; CHECK:     Flags: 0x1
127; CHECK:     CodeSize: 0x14
128; CHECK:     FilenameSegment [
129; CHECK:       +0x0 [
130; CHECK:         LineNumberStart: 1
131; CHECK:         LineNumberEndDelta: 0
132; CHECK:         IsStatement: No
133; CHECK:         ColStart: 0
134; CHECK:         ColEnd: 0
135; CHECK:       ]
136; CHECK:       +0x8 [
137; CHECK:         LineNumberStart: 2
138; CHECK:         LineNumberEndDelta: 0
139; CHECK:         IsStatement: No
140; CHECK:         ColStart: 3
141; CHECK:         ColEnd: 0
142; CHECK:       ]
143; CHECK:     ]
144; CHECK:   ]
145; CHECK: ]
146