aboutsummaryrefslogtreecommitdiff
path: root/src/link/Dwarf.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-12-06 21:35:27 +0100
committerJakub Konka <kubkon@jakubkonka.com>2022-12-09 09:24:25 +0100
commit6ec34edb9a2e45226bcedbae896ba2aa11b4ed7b (patch)
treebd99d358be06a2fe01272061d091398b0a4937dd /src/link/Dwarf.zig
parentf5c764d8923d301bb7e46b50cb034285640fcca2 (diff)
downloadzig-6ec34edb9a2e45226bcedbae896ba2aa11b4ed7b.tar.gz
zig-6ec34edb9a2e45226bcedbae896ba2aa11b4ed7b.zip
dwarf: fully resolve each path to each file source
Diffstat (limited to 'src/link/Dwarf.zig')
-rw-r--r--src/link/Dwarf.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig
index 12b34a070b..7d25f05877 100644
--- a/src/link/Dwarf.zig
+++ b/src/link/Dwarf.zig
@@ -59,8 +59,10 @@ const DIFile = struct {
file_source: *const Module.File,
ref_count: u32,
- fn getFullPath(dif: DIFile, allocator: Allocator) ![]const u8 {
- return dif.file_source.fullPath(allocator);
+ fn getFullyResolvedPath(dif: DIFile, allocator: Allocator) ![]const u8 {
+ const path = try dif.file_source.fullPath(allocator);
+ defer allocator.free(path);
+ return fs.realpathAlloc(allocator, path);
}
};
@@ -2358,7 +2360,7 @@ pub fn writeDbgLineHeader(self: *Dwarf, module: *Module) !void {
});
for (self.di_files.items) |dif, i| {
- const full_path = try dif.getFullPath(self.allocator);
+ const full_path = try dif.getFullyResolvedPath(self.allocator);
defer self.allocator.free(full_path);
log.debug("adding new file name at {d} of '{s}'", .{ i + 1, full_path });
di_buf.appendSliceAssumeCapacity(full_path);