xref: /llvm-project/llvm/test/Instrumentation/JustMyCode/jmc-instrument-elf.ll (revision 62b21c6ced918c7fec97b557e3087e3ffdf71494)
1; RUN: opt -jmc-instrumenter -mtriple=x86_64-unknown-linux-gnu  -S < %s | FileCheck %s
2; RUN: opt -passes=jmc-instrumenter -mtriple=x86_64-unknown-linux-gnu  -S < %s | FileCheck %s
3
4; CHECK: @"__7DF23CF5_x@c" = internal unnamed_addr global i8 1, section ".data.just.my.code", align 1, !dbg !0
5; CHECK: @"__A8764FDD_x@c" = internal unnamed_addr global i8 1, section ".data.just.my.code", align 1, !dbg !5
6
7; CHECK: define void @l1() !dbg !12 {
8; CHECK:   call void @__CheckForDebuggerJustMyCode(ptr noundef @"__7DF23CF5_x@c")
9; CHECK:   ret void
10; CHECK: }
11
12; CHECK: define void @l2() !dbg !16 {
13; CHECK:   call void @__CheckForDebuggerJustMyCode(ptr noundef @"__7DF23CF5_x@c")
14; CHECK:   ret void
15; CHECK: }
16
17; CHECK: define void @w1() !dbg !18 {
18; CHECK:   call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
19; CHECK:   ret void
20; CHECK: }
21
22; CHECK: define void @w2() !dbg !19 {
23; CHECK:   call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
24; CHECK:   ret void
25; CHECK: }
26
27; CHECK: define void @w3() !dbg !21 {
28; CHECK:   call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
29; CHECK:   ret void
30; CHECK: }
31
32; CHECK: define void @w4() !dbg !23 {
33; CHECK:   call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
34; CHECK:   ret void
35; CHECK: }
36
37; CHECK: define weak void @__CheckForDebuggerJustMyCode(ptr noundef %0) unnamed_addr {
38; CHECK:   ret void
39; CHECK: }
40
41; CHECK: !llvm.dbg.cu = !{!2}
42; CHECK: !llvm.module.flags = !{!9, !10}
43; CHECK: !llvm.ident = !{!11}
44
45; CHECK: !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
46; CHECK: !1 = distinct !DIGlobalVariable(name: "__7DF23CF5_x@c", scope: !2, file: !3, type: !8, isLocal: true, isDefinition: true)
47; CHECK: !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
48; CHECK: !3 = !DIFile(filename: "a/x.c", directory: "/tmp")
49; CHECK: !4 = !{!0, !5}
50; CHECK: !5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
51; CHECK: !6 = distinct !DIGlobalVariable(name: "__A8764FDD_x@c", scope: !2, file: !7, type: !8, isLocal: true, isDefinition: true)
52; CHECK: !7 = !DIFile(filename: "./x.c", directory: "C:\\\\a\\\\b\\\\")
53; CHECK: !8 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char, flags: DIFlagArtificial)
54; CHECK: !9 = !{i32 2, !"CodeView", i32 1}
55; CHECK: !10 = !{i32 2, !"Debug Info Version", i32 3}
56; CHECK: !11 = !{!"clang"}
57; CHECK: !12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
58; CHECK: !13 = !DISubroutineType(types: !14)
59; CHECK: !14 = !{null}
60; CHECK: !15 = !{}
61; CHECK: !16 = distinct !DISubprogram(name: "f", scope: !17, file: !17, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
62; CHECK: !17 = !DIFile(filename: "x.c", directory: "/tmp/a")
63; CHECK: !18 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
64; CHECK: !19 = distinct !DISubprogram(name: "f", scope: !20, file: !20, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
65; CHECK: !20 = !DIFile(filename: "./b\\x.c", directory: "C:\\\\a\\\\")
66; CHECK: !21 = distinct !DISubprogram(name: "f", scope: !22, file: !22, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
67; CHECK: !22 = !DIFile(filename: "./b/x.c", directory: "C:\\\\a\\\\")
68; CHECK: !23 = distinct !DISubprogram(name: "f", scope: !24, file: !24, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
69; CHECK: !24 = !DIFile(filename: "./b/./../b/x.c", directory: "C:\\\\a")
70
71; All use the same flag
72define void @l1() !dbg !10 {
73  ret void
74}
75define void @l2() !dbg !11 {
76  ret void
77}
78
79; All use the same flag
80define void @w1() !dbg !12 {
81  ret void
82}
83define void @w2() !dbg !13 {
84  ret void
85}
86define void @w3() !dbg !14 {
87  ret void
88}
89define void @w4() !dbg !15 {
90  ret void
91}
92
93!llvm.dbg.cu = !{!0}
94!llvm.module.flags = !{!7, !8}
95!llvm.ident = !{!9}
96
97!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
98!1 = !DIFile(filename: "a/x.c", directory: "/tmp")
99!2 = !DIFile(filename: "x.c", directory: "/tmp/a")
100!3 = !DIFile(filename: "./x.c", directory: "C:\\\\a\\\\b\\\\")
101!4 = !DIFile(filename: "./b\\x.c", directory: "C:\\\\a\\\\")
102!5 = !DIFile(filename: "./b/x.c", directory: "C:\\\\a\\\\")
103!6 = !DIFile(filename: "./b/./../b/x.c", directory: "C:\\\\a")
104!7 = !{i32 2, !"CodeView", i32 1}
105!8 = !{i32 2, !"Debug Info Version", i32 3}
106!9 = !{!"clang"}
107!10 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
108!11 = distinct !DISubprogram(name: "f", scope: !2, file: !2, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
109!12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
110!13 = distinct !DISubprogram(name: "f", scope: !4, file: !4, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
111!14 = distinct !DISubprogram(name: "f", scope: !5, file: !5, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
112!15 = distinct !DISubprogram(name: "f", scope: !6, file: !6, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
113!31 = !DISubroutineType(types: !32)
114!32 = !{null}
115!33 = !{}
116