add workaround for #5525

This commit is contained in:
Vexu 2020-06-04 13:11:23 +03:00
parent 6524a64bda
commit fd067fbe8b
No known key found for this signature in database
GPG Key ID: 59AEB8936E16A6AC

View File

@ -1295,10 +1295,13 @@ pub const DebugInfo = struct {
const obj_di = try self.allocator.create(ModuleDebugInfo); const obj_di = try self.allocator.create(ModuleDebugInfo);
errdefer self.allocator.destroy(obj_di); 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 }) fs.cwd().openFile(ctx.name, .{ .intended_io_mode = .blocking })
else 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, error.FileNotFound => return error.MissingDebugInfo,
else => return err, else => return err,
}; };