| ... | ... | @@ -673,6 +673,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { |
| 673 | 673 | /// This takes ownership of coff_file: users of this function should not close |
| 674 | 674 | /// it themselves, even on error. |
| 675 | 675 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 676 | /// TODO it's weird to take ownership even on error, rework this code. |
| 676 | 677 | fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInfo { |
| 677 | 678 | nosuspend { |
| 678 | 679 | errdefer coff_file.close(); |
| ... | ... | @@ -855,6 +856,7 @@ fn chopSlice(ptr: []const u8, offset: u64, size: u64) ![]const u8 { |
| 855 | 856 | /// This takes ownership of elf_file: users of this function should not close |
| 856 | 857 | /// it themselves, even on error. |
| 857 | 858 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 859 | /// TODO it's weird to take ownership even on error, rework this code. |
| 858 | 860 | pub fn readElfDebugInfo(allocator: *mem.Allocator, elf_file: File) !ModuleDebugInfo { |
| 859 | 861 | nosuspend { |
| 860 | 862 | const mapped_mem = try mapWholeFile(elf_file); |
| ... | ... | @@ -926,6 +928,7 @@ pub fn readElfDebugInfo(allocator: *mem.Allocator, elf_file: File) !ModuleDebugI |
| 926 | 928 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 927 | 929 | /// This takes ownership of coff_file: users of this function should not close |
| 928 | 930 | /// it themselves, even on error. |
| 931 | /// TODO it's weird to take ownership even on error, rework this code. |
| 929 | 932 | fn readMachODebugInfo(allocator: *mem.Allocator, macho_file: File) !ModuleDebugInfo { |
| 930 | 933 | const mapped_mem = try mapWholeFile(macho_file); |
| 931 | 934 | |
| ... | ... | @@ -1060,6 +1063,9 @@ const MachoSymbol = struct { |
| 1060 | 1063 | } |
| 1061 | 1064 | }; |
| 1062 | 1065 | |
| 1066 | /// `file` is expected to have been opened with .intended_io_mode == .blocking. |
| 1067 | /// Takes ownership of file, even on error. |
| 1068 | /// TODO it's weird to take ownership even on error, rework this code. |
| 1063 | 1069 | fn mapWholeFile(file: File) ![]align(mem.page_size) const u8 { |
| 1064 | 1070 | nosuspend { |
| 1065 | 1071 | defer file.close(); |
| ... | ... | @@ -1144,7 +1150,7 @@ pub const DebugInfo = struct { |
| 1144 | 1150 | errdefer self.allocator.destroy(obj_di); |
| 1145 | 1151 | |
| 1146 | 1152 | const macho_path = mem.spanZ(std.c._dyld_get_image_name(i)); |
| 1147 | | const macho_file = fs.cwd().openFile(macho_path, .{ .always_blocking = true }) catch |err| switch (err) { |
| 1153 | const macho_file = fs.cwd().openFile(macho_path, .{ .intended_io_mode = .blocking }) catch |err| switch (err) { |
| 1148 | 1154 | error.FileNotFound => return error.MissingDebugInfo, |
| 1149 | 1155 | else => return err, |
| 1150 | 1156 | }; |
| ... | ... | @@ -1290,9 +1296,9 @@ pub const DebugInfo = struct { |
| 1290 | 1296 | errdefer self.allocator.destroy(obj_di); |
| 1291 | 1297 | |
| 1292 | 1298 | const elf_file = (if (ctx.name.len > 0) |
| 1293 | | fs.cwd().openFile(ctx.name, .{ .always_blocking = true }) |
| 1299 | fs.cwd().openFile(ctx.name, .{ .intended_io_mode = .blocking }) |
| 1294 | 1300 | else |
| 1295 | | fs.openSelfExe(.{ .always_blocking = true })) catch |err| switch (err) { |
| 1301 | fs.openSelfExe(.{ .intended_io_mode = .blocking })) catch |err| switch (err) { |
| 1296 | 1302 | error.FileNotFound => return error.MissingDebugInfo, |
| 1297 | 1303 | else => return err, |
| 1298 | 1304 | }; |
| ... | ... | @@ -1333,7 +1339,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { |
| 1333 | 1339 | } |
| 1334 | 1340 | |
| 1335 | 1341 | fn loadOFile(self: *@This(), o_file_path: []const u8) !DW.DwarfInfo { |
| 1336 | | const o_file = try fs.cwd().openFile(o_file_path, .{ .always_blocking = true }); |
| 1342 | const o_file = try fs.cwd().openFile(o_file_path, .{ .intended_io_mode = .blocking }); |
| 1337 | 1343 | const mapped_mem = try mapWholeFile(o_file); |
| 1338 | 1344 | |
| 1339 | 1345 | const hdr = @ptrCast( |