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
+13 -7
View File
@@ -24,13 +24,13 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: define void @F() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8
// CHECK:STDOUT: %.loc14_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0
// CHECK:STDOUT: %.loc14_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc14_47, i64 8, i1 false)
// CHECK:STDOUT: %.loc15_7.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1
// CHECK:STDOUT: call void @G(ptr %.loc15_7.b)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8, !dbg !7
// CHECK:STDOUT: %.loc14_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0, !dbg !8
// CHECK:STDOUT: %.loc14_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !8
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc14_47, i64 8, i1 false), !dbg !9
// CHECK:STDOUT: %.loc15_7.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !10
// CHECK:STDOUT: call void @G(ptr %.loc15_7.b), !dbg !11
// CHECK:STDOUT: ret void, !dbg !12
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
@@ -48,3 +48,9 @@ fn F() {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", 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: 31, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !4)
// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 6, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 3, scope: !4)
// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 1, scope: !4)
+6 -3
View File
@@ -18,9 +18,9 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: define void @F() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %n.var = alloca i32, align 4
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4
// CHECK:STDOUT: ret void
// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !8
// CHECK:STDOUT: ret void, !dbg !9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
@@ -33,3 +33,6 @@ fn F() {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", 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: 11, column: 1, scope: !4)
+14 -8
View File
@@ -22,16 +22,16 @@ fn F() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @G(ptr %p) !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc12_10.2 = load i32, ptr %p, align 4
// CHECK:STDOUT: ret i32 %.loc12_10.2
// CHECK:STDOUT: %.loc12_10.2 = load i32, ptr %p, align 4, !dbg !7
// CHECK:STDOUT: ret i32 %.loc12_10.2, !dbg !8
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @F() !dbg !7 {
// CHECK:STDOUT: define i32 @F() !dbg !9 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %n.var = alloca i32, align 4
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4
// CHECK:STDOUT: %G.call = call i32 @G(ptr %n.var)
// CHECK:STDOUT: ret i32 %G.call
// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !10
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !11
// CHECK:STDOUT: %G.call = call i32 @G(ptr %n.var), !dbg !12
// CHECK:STDOUT: ret i32 %G.call, !dbg !13
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
@@ -44,4 +44,10 @@ fn F() -> i32 {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 10, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4)
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 7, scope: !9)
// CHECK:STDOUT: !11 = !DILocation(line: 16, column: 3, scope: !9)
// CHECK:STDOUT: !12 = !DILocation(line: 17, column: 10, scope: !9)
// CHECK:STDOUT: !13 = !DILocation(line: 17, column: 3, scope: !9)
+22 -11
View File
@@ -20,17 +20,17 @@ fn F(p: i32**) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @F(ptr %p) !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %a.var = alloca ptr, align 8
// CHECK:STDOUT: store ptr %p, ptr %a.var, align 8
// CHECK:STDOUT: %b.var = alloca ptr, align 8
// CHECK:STDOUT: %.loc13_17.2 = load ptr, ptr %p, align 8
// CHECK:STDOUT: store ptr %.loc13_17.2, ptr %b.var, align 8
// CHECK:STDOUT: %c.var = alloca ptr, align 8
// CHECK:STDOUT: store ptr %b.var, ptr %c.var, align 8
// CHECK:STDOUT: %.loc15_12 = load ptr, ptr %c.var, align 8
// CHECK:STDOUT: %.loc15_11.2 = load ptr, ptr %.loc15_12, align 8
// CHECK:STDOUT: %.loc15_10.2 = load i32, ptr %.loc15_11.2, align 4
// CHECK:STDOUT: ret i32 %.loc15_10.2
// CHECK:STDOUT: %a.var = alloca ptr, align 8, !dbg !7
// CHECK:STDOUT: store ptr %p, ptr %a.var, align 8, !dbg !8
// CHECK:STDOUT: %b.var = alloca ptr, align 8, !dbg !9
// CHECK:STDOUT: %.loc13_17.2 = load ptr, ptr %p, align 8, !dbg !10
// CHECK:STDOUT: store ptr %.loc13_17.2, ptr %b.var, align 8, !dbg !11
// CHECK:STDOUT: %c.var = alloca ptr, align 8, !dbg !12
// CHECK:STDOUT: store ptr %b.var, ptr %c.var, align 8, !dbg !13
// CHECK:STDOUT: %.loc15_12 = load ptr, ptr %c.var, align 8, !dbg !14
// CHECK:STDOUT: %.loc15_11.2 = load ptr, ptr %.loc15_12, align 8, !dbg !15
// CHECK:STDOUT: %.loc15_10.2 = load i32, ptr %.loc15_11.2, align 4, !dbg !16
// CHECK:STDOUT: ret i32 %.loc15_10.2, !dbg !17
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
@@ -43,3 +43,14 @@ fn F(p: i32**) -> i32 {
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", 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: 17, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 3, scope: !4)
// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 7, scope: !4)
// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 3, scope: !4)
// CHECK:STDOUT: !14 = !DILocation(line: 15, column: 12, scope: !4)
// CHECK:STDOUT: !15 = !DILocation(line: 15, column: 11, scope: !4)
// CHECK:STDOUT: !16 = !DILocation(line: 15, column: 10, scope: !4)
// CHECK:STDOUT: !17 = !DILocation(line: 15, column: 3, scope: !4)