Add line-level debug info (#4247)

Seems to work with lldb ( https://pastebin.com/igKkNECm ), though gdb
has /some/ trouble with the paths (they aren't complete - just using the
filename directly, not providing the working directory - might be some
quick hacks that can help there).
This commit is contained in:
David Blaikie
2024-08-26 15:49:31 +00:00
committed by GitHub
parent 5d73743971
commit 0ae2a3907e
104 changed files with 1586 additions and 1009 deletions
+6 -3
View File
@@ -19,9 +19,9 @@ fn Run() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @main() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %x.var = alloca {}, align 8
// CHECK:STDOUT: %y.var = alloca {}, align 8
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: %x.var = alloca {}, align 8, !dbg !7
// CHECK:STDOUT: %y.var = alloca {}, align 8, !dbg !8
// CHECK:STDOUT: ret i32 0, !dbg !9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
@@ -34,3 +34,6 @@ fn Run() -> i32 {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 13, column: 7, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !4)
+22 -12
View File
@@ -22,18 +22,18 @@ fn Run() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @main() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8
// CHECK:STDOUT: %.loc12_48.2.a = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 0
// CHECK:STDOUT: %.loc12_48.4.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.loc12_49, i64 16, i1 false)
// CHECK:STDOUT: %y.var = alloca i32, align 4
// CHECK:STDOUT: %.loc13_17.1.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1
// CHECK:STDOUT: %.loc13_17.2 = load i32, ptr %.loc13_17.1.b, align 4
// CHECK:STDOUT: store i32 %.loc13_17.2, ptr %y.var, align 4
// CHECK:STDOUT: %z.var = alloca i32, align 4
// CHECK:STDOUT: %.loc14_16 = load i32, ptr %y.var, align 4
// CHECK:STDOUT: store i32 %.loc14_16, ptr %z.var, align 4
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8, !dbg !7
// CHECK:STDOUT: %.loc12_48.2.a = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8
// CHECK:STDOUT: %.loc12_48.4.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.loc12_49, i64 16, i1 false), !dbg !9
// CHECK:STDOUT: %y.var = alloca i32, align 4, !dbg !10
// CHECK:STDOUT: %.loc13_17.1.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1, !dbg !11
// CHECK:STDOUT: %.loc13_17.2 = load i32, ptr %.loc13_17.1.b, align 4, !dbg !11
// CHECK:STDOUT: store i32 %.loc13_17.2, ptr %y.var, align 4, !dbg !12
// CHECK:STDOUT: %z.var = alloca i32, align 4, !dbg !13
// CHECK:STDOUT: %.loc14_16 = load i32, ptr %y.var, align 4, !dbg !14
// CHECK:STDOUT: store i32 %.loc14_16, ptr %z.var, align 4, !dbg !15
// CHECK:STDOUT: ret i32 0, !dbg !16
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
@@ -51,3 +51,13 @@ fn Run() -> i32 {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 31, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4)
// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 16, scope: !4)
// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 3, scope: !4)
// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 7, scope: !4)
// CHECK:STDOUT: !14 = !DILocation(line: 14, column: 16, scope: !4)
// CHECK:STDOUT: !15 = !DILocation(line: 14, column: 3, scope: !4)
// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 3, scope: !4)
+2 -1
View File
@@ -18,7 +18,7 @@ fn Run() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @main() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: ret i32 0, !dbg !7
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
@@ -31,3 +31,4 @@ fn Run() -> i32 {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 13, column: 3, scope: !4)
@@ -21,12 +21,12 @@ fn G() {
// CHECK:STDOUT:
// CHECK:STDOUT: define void @G() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8
// CHECK:STDOUT: %.loc14_74.1.a = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0
// CHECK:STDOUT: call void @F(ptr %.loc14_74.1.a)
// CHECK:STDOUT: %.loc14_74.2.b = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1
// CHECK:STDOUT: call void @F(ptr %.loc14_74.2.b)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8, !dbg !7
// CHECK:STDOUT: %.loc14_74.1.a = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0, !dbg !8
// CHECK:STDOUT: call void @F(ptr %.loc14_74.1.a), !dbg !9
// CHECK:STDOUT: %.loc14_74.2.b = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !8
// CHECK:STDOUT: call void @F(ptr %.loc14_74.2.b), !dbg !10
// CHECK:STDOUT: ret void, !dbg !11
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
@@ -39,3 +39,8 @@ fn G() {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 55, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 61, scope: !4)
// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 71, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !4)
+14 -8
View File
@@ -19,14 +19,14 @@ fn Run() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @main() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %x.var = alloca { i32 }, align 8
// CHECK:STDOUT: store { i32 } { i32 4 }, ptr %x.var, align 4
// CHECK:STDOUT: %y.var = alloca { i32 }, align 8
// CHECK:STDOUT: %.loc13_22.1.a = getelementptr inbounds nuw { i32 }, ptr %x.var, i32 0, i32 0
// CHECK:STDOUT: %.loc13_22.2 = load i32, ptr %.loc13_22.1.a, align 4
// CHECK:STDOUT: %.loc13_22.3.struct.init = insertvalue { i32 } poison, i32 %.loc13_22.2, 0
// CHECK:STDOUT: store { i32 } %.loc13_22.3.struct.init, ptr %y.var, align 4
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: %x.var = alloca { i32 }, align 8, !dbg !7
// CHECK:STDOUT: store { i32 } { i32 4 }, ptr %x.var, align 4, !dbg !8
// CHECK:STDOUT: %y.var = alloca { i32 }, align 8, !dbg !9
// CHECK:STDOUT: %.loc13_22.1.a = getelementptr inbounds nuw { i32 }, ptr %x.var, i32 0, i32 0, !dbg !10
// CHECK:STDOUT: %.loc13_22.2 = load i32, ptr %.loc13_22.1.a, align 4, !dbg !10
// CHECK:STDOUT: %.loc13_22.3.struct.init = insertvalue { i32 } poison, i32 %.loc13_22.2, 0, !dbg !10
// CHECK:STDOUT: store { i32 } %.loc13_22.3.struct.init, ptr %y.var, align 4, !dbg !11
// CHECK:STDOUT: ret i32 0, !dbg !12
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
@@ -39,3 +39,9 @@ fn Run() -> i32 {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 7, scope: !4)
// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 22, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 3, scope: !4)
// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 3, scope: !4)
+20 -14
View File
@@ -21,20 +21,20 @@ fn Run() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @main() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8
// CHECK:STDOUT: %.loc12_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0
// CHECK:STDOUT: %.loc12_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.loc12_47, i64 8, i1 false)
// CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8
// CHECK:STDOUT: %.loc13_31.1.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0
// CHECK:STDOUT: %.loc13_31.2 = load i32, ptr %.loc13_31.1.a, align 4
// CHECK:STDOUT: %.loc13_31.3.a = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 0
// CHECK:STDOUT: store i32 %.loc13_31.2, ptr %.loc13_31.3.a, align 4
// CHECK:STDOUT: %.loc13_31.5.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1
// CHECK:STDOUT: %.loc13_31.6 = load i32, ptr %.loc13_31.5.b, align 4
// CHECK:STDOUT: %.loc13_31.7.b = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 1
// CHECK:STDOUT: store i32 %.loc13_31.6, ptr %.loc13_31.7.b, align 4
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8, !dbg !7
// CHECK:STDOUT: %.loc12_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8
// CHECK:STDOUT: %.loc12_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.loc12_47, i64 8, i1 false), !dbg !9
// CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8, !dbg !10
// CHECK:STDOUT: %.loc13_31.1.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !11
// CHECK:STDOUT: %.loc13_31.2 = load i32, ptr %.loc13_31.1.a, align 4, !dbg !11
// CHECK:STDOUT: %.loc13_31.3.a = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 0, !dbg !11
// CHECK:STDOUT: store i32 %.loc13_31.2, ptr %.loc13_31.3.a, align 4, !dbg !11
// CHECK:STDOUT: %.loc13_31.5.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !11
// CHECK:STDOUT: %.loc13_31.6 = load i32, ptr %.loc13_31.5.b, align 4, !dbg !11
// CHECK:STDOUT: %.loc13_31.7.b = getelementptr inbounds nuw { i32, i32 }, ptr %y.var, i32 0, i32 1, !dbg !11
// CHECK:STDOUT: store i32 %.loc13_31.6, ptr %.loc13_31.7.b, align 4, !dbg !11
// CHECK:STDOUT: ret i32 0, !dbg !12
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
@@ -52,3 +52,9 @@ fn Run() -> i32 {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 31, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 3, scope: !4)
// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 7, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 31, scope: !4)
// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 3, scope: !4)