mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:14:42 +01:00
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:
+11
-7
@@ -32,15 +32,15 @@ fn Call(a: A) -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @F(ptr %self) !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %.loc22_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0
|
||||
// CHECK:STDOUT: %.loc22_16.2 = load i32, ptr %.loc22_16.1.n, align 4
|
||||
// CHECK:STDOUT: ret i32 %.loc22_16.2
|
||||
// CHECK:STDOUT: %.loc22_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7
|
||||
// CHECK:STDOUT: %.loc22_16.2 = load i32, ptr %.loc22_16.1.n, align 4, !dbg !7
|
||||
// CHECK:STDOUT: ret i32 %.loc22_16.2, !dbg !8
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !7 {
|
||||
// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !9 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %F.call = call i32 @F(ptr %a)
|
||||
// CHECK:STDOUT: ret i32 %F.call
|
||||
// CHECK:STDOUT: %F.call = call i32 @F(ptr %a), !dbg !10
|
||||
// CHECK:STDOUT: ret i32 %F.call, !dbg !11
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
||||
@@ -53,4 +53,8 @@ fn Call(a: A) -> i32 {
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 22, column: 12, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 22, column: 5, scope: !4)
|
||||
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 27, column: 10, scope: !9)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 27, column: 3, scope: !9)
|
||||
|
||||
+14
-9
@@ -33,19 +33,19 @@ fn InstanceAccess(a: A) -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @F() !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: ret i32 0
|
||||
// CHECK:STDOUT: ret i32 0, !dbg !7
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @TypeAccess() !dbg !7 {
|
||||
// CHECK:STDOUT: define i32 @TypeAccess() !dbg !8 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %F.call = call i32 @F()
|
||||
// CHECK:STDOUT: ret i32 %F.call
|
||||
// CHECK:STDOUT: %F.call = call i32 @F(), !dbg !9
|
||||
// CHECK:STDOUT: ret i32 %F.call, !dbg !10
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @InstanceAccess(ptr %a) !dbg !8 {
|
||||
// CHECK:STDOUT: define i32 @InstanceAccess(ptr %a) !dbg !11 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %F.call = call i32 @F()
|
||||
// CHECK:STDOUT: ret i32 %F.call
|
||||
// CHECK:STDOUT: %F.call = call i32 @F(), !dbg !12
|
||||
// CHECK:STDOUT: ret i32 %F.call, !dbg !13
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
||||
@@ -58,5 +58,10 @@ fn InstanceAccess(a: A) -> i32 {
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "TypeAccess", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "InstanceAccess", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 18, column: 7, scope: !4)
|
||||
// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "TypeAccess", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 24, column: 10, scope: !8)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 24, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "InstanceAccess", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 28, column: 10, scope: !11)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 28, column: 3, scope: !11)
|
||||
|
||||
+11
-7
@@ -31,15 +31,15 @@ fn Call(a: A) -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @F(ptr %self) !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %.loc21_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0
|
||||
// CHECK:STDOUT: %.loc21_16.2 = load i32, ptr %.loc21_16.1.n, align 4
|
||||
// CHECK:STDOUT: ret i32 %.loc21_16.2
|
||||
// CHECK:STDOUT: %.loc21_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7
|
||||
// CHECK:STDOUT: %.loc21_16.2 = load i32, ptr %.loc21_16.1.n, align 4, !dbg !7
|
||||
// CHECK:STDOUT: ret i32 %.loc21_16.2, !dbg !8
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !7 {
|
||||
// CHECK:STDOUT: define i32 @Call(ptr %a) !dbg !9 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %F.call = call i32 @F(ptr %a)
|
||||
// CHECK:STDOUT: ret i32 %F.call
|
||||
// CHECK:STDOUT: %F.call = call i32 @F(ptr %a), !dbg !10
|
||||
// CHECK:STDOUT: ret i32 %F.call, !dbg !11
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
||||
@@ -52,4 +52,8 @@ fn Call(a: A) -> i32 {
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 21, column: 12, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 21, column: 5, scope: !4)
|
||||
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 26, column: 10, scope: !9)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 26, column: 3, scope: !9)
|
||||
|
||||
+8
-5
@@ -31,13 +31,13 @@ fn Call(a: A*) -> A* {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define ptr @Get(ptr %self) !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: ret ptr %self
|
||||
// CHECK:STDOUT: ret ptr %self, !dbg !7
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define ptr @Call(ptr %a) !dbg !7 {
|
||||
// CHECK:STDOUT: define ptr @Call(ptr %a) !dbg !8 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %Get.call = call ptr @Get(ptr %a)
|
||||
// CHECK:STDOUT: ret ptr %Get.call
|
||||
// CHECK:STDOUT: %Get.call = call ptr @Get(ptr %a), !dbg !9
|
||||
// CHECK:STDOUT: ret ptr %Get.call, !dbg !10
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
||||
@@ -50,4 +50,7 @@ fn Call(a: A*) -> A* {
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Get", scope: null, file: !3, line: 19, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 20, column: 7, scope: !4)
|
||||
// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Call", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 26, column: 10, scope: !8)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 26, column: 3, scope: !8)
|
||||
|
||||
Reference in New Issue
Block a user