diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-28 13:06:35 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-28 21:58:41 +0200 |
| commit | a660df4900520c505a0865707552dcc777f4b791 (patch) | |
| tree | a4ebdc4aa4ce45b0971d39ca3cc287d2d0c3c218 /src/codegen | |
| parent | da9c530d9937abd1c17b9eeabec199076428a177 (diff) | |
| download | zig-a660df4900520c505a0865707552dcc777f4b791.tar.gz zig-a660df4900520c505a0865707552dcc777f4b791.zip | |
llvm: improve emitted debug info
* ensure parameter debug info is in the subroutine di scope
* slit sub file path into basename and dirname
Closes #12257
Closes #12665
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/llvm.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index a78b201a0a..02fa34fe87 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1179,8 +1179,7 @@ pub const Object = struct { llvm_func.fnSetSubprogram(subprogram); - const lexical_block = dib.createLexicalBlock(subprogram.toScope(), di_file.?, line_number, 1); - di_scope = lexical_block.toScope(); + di_scope = subprogram.toScope(); } var fg: FuncGen = .{ @@ -1393,9 +1392,10 @@ pub const Object = struct { return @ptrCast(*llvm.DIFile, gop.value_ptr.*); } const dir_path = file.pkg.root_src_directory.path orelse "."; - const sub_file_path_z = try gpa.dupeZ(u8, file.sub_file_path); + const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path)); defer gpa.free(sub_file_path_z); - const dir_path_z = try gpa.dupeZ(u8, dir_path); + const stage1_workaround = std.fs.path.dirname(file.sub_file_path) orelse ""; + const dir_path_z = try std.fs.path.joinZ(gpa, &.{ dir_path, stage1_workaround }); defer gpa.free(dir_path_z); const di_file = o.di_builder.?.createFile(sub_file_path_z, dir_path_z); gop.value_ptr.* = di_file.toNode(); |
