From fd067fbe8b14c445ed764da15fff5163156126df Mon Sep 17 00:00:00 2001 From: Vexu Date: Thu, 4 Jun 2020 13:11:23 +0300 Subject: [PATCH] add workaround for #5525 --- lib/std/debug.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index bf82dab49c..0e234ab419 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1295,10 +1295,13 @@ pub const DebugInfo = struct { const obj_di = try self.allocator.create(ModuleDebugInfo); errdefer self.allocator.destroy(obj_di); - const elf_file = (if (ctx.name.len > 0) + // TODO https://github.com/ziglang/zig/issues/5525 + const copy = if (ctx.name.len > 0) fs.cwd().openFile(ctx.name, .{ .intended_io_mode = .blocking }) else - fs.openSelfExe(.{ .intended_io_mode = .blocking })) catch |err| switch (err) { + fs.openSelfExe(.{ .intended_io_mode = .blocking }); + + const elf_file = copy catch |err| switch (err) { error.FileNotFound => return error.MissingDebugInfo, else => return err, };