authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-06 21:35:27+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-09 09:24:25+01:00
log6ec34edb9a2e45226bcedbae896ba2aa11b4ed7b
treebd99d358be06a2fe01272061d091398b0a4937dd
parentf5c764d8923d301bb7e46b50cb034285640fcca2

dwarf: fully resolve each path to each file source


1 files changed, 5 insertions(+), 3 deletions(-)

src/link/Dwarf.zig+5-3
...@@ -59,8 +59,10 @@ const DIFile = struct {...@@ -59,8 +59,10 @@ const DIFile = struct {
59 file_source: *const Module.File,59 file_source: *const Module.File,
60 ref_count: u32,60 ref_count: u32,
6161
62 fn getFullPath(dif: DIFile, allocator: Allocator) ![]const u8 {62 fn getFullyResolvedPath(dif: DIFile, allocator: Allocator) ![]const u8 {
63 return dif.file_source.fullPath(allocator);63 const path = try dif.file_source.fullPath(allocator);
64 defer allocator.free(path);
65 return fs.realpathAlloc(allocator, path);
64 }66 }
65};67};
6668
...@@ -2358,7 +2360,7 @@ pub fn writeDbgLineHeader(self: *Dwarf, module: *Module) !void {...@@ -2358,7 +2360,7 @@ pub fn writeDbgLineHeader(self: *Dwarf, module: *Module) !void {
2358 });2360 });
23592361
2360 for (self.di_files.items) |dif, i| {2362 for (self.di_files.items) |dif, i| {
2361 const full_path = try dif.getFullPath(self.allocator);2363 const full_path = try dif.getFullyResolvedPath(self.allocator);
2362 defer self.allocator.free(full_path);2364 defer self.allocator.free(full_path);
2363 log.debug("adding new file name at {d} of '{s}'", .{ i + 1, full_path });2365 log.debug("adding new file name at {d} of '{s}'", .{ i + 1, full_path });
2364 di_buf.appendSliceAssumeCapacity(full_path);2366 di_buf.appendSliceAssumeCapacity(full_path);