diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-02-09 13:38:42 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-09 13:38:42 -0800 |
| commit | 54bbc73f8502fe073d385361ddb34a43d12eec39 (patch) | |
| tree | 6eb554a4639f2c05bdfa5fc94553edc7f5df1650 /lib/std/debug.zig | |
| parent | d3cf911a803912a5aabe7a8d130c8b6468b95ff1 (diff) | |
| parent | 318e9cdaaae2f01c1a6e5db9cf66fe875821787e (diff) | |
| download | zig-54bbc73f8502fe073d385361ddb34a43d12eec39.tar.gz zig-54bbc73f8502fe073d385361ddb34a43d12eec39.zip | |
Merge pull request #18712 from Vexu/std.options
std: make options a struct instance instead of a namespace
Diffstat (limited to 'lib/std/debug.zig')
| -rw-r--r-- | lib/std/debug.zig | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 7f44cfa770..601a949ecf 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1141,8 +1141,8 @@ pub fn readElfDebugInfo( ) !ModuleDebugInfo { nosuspend { const elf_file = (if (elf_filename) |filename| blk: { - break :blk fs.cwd().openFile(filename, .{ .intended_io_mode = .blocking }); - } else fs.openSelfExe(.{ .intended_io_mode = .blocking })) catch |err| switch (err) { + break :blk fs.cwd().openFile(filename, .{}); + } else fs.openSelfExe(.{})) catch |err| switch (err) { error.FileNotFound => return error.MissingDebugInfo, else => return err, }; @@ -1452,7 +1452,7 @@ fn readMachODebugInfo(allocator: mem.Allocator, macho_file: File) !ModuleDebugIn fn printLineFromFileAnyOs(out_stream: anytype, line_info: LineInfo) !void { // Need this to always block even in async I/O mode, because this could potentially // be called from e.g. the event loop code crashing. - var f = try fs.cwd().openFile(line_info.file_name, .{ .intended_io_mode = .blocking }); + var f = try fs.cwd().openFile(line_info.file_name, .{}); defer f.close(); // TODO fstat and make sure that the file has the correct size @@ -1640,7 +1640,6 @@ const MachoSymbol = struct { } }; -/// `file` is expected to have been opened with .intended_io_mode == .blocking. /// Takes ownership of file, even on error. /// TODO it's weird to take ownership even on error, rework this code. fn mapWholeFile(file: File) ![]align(mem.page_size) const u8 { @@ -1824,9 +1823,7 @@ pub const DebugInfo = struct { errdefer self.allocator.destroy(obj_di); const macho_path = mem.sliceTo(std.c._dyld_get_image_name(i), 0); - const macho_file = fs.cwd().openFile(macho_path, .{ - .intended_io_mode = .blocking, - }) catch |err| switch (err) { + const macho_file = fs.cwd().openFile(macho_path, .{}) catch |err| switch (err) { error.FileNotFound => return error.MissingDebugInfo, else => return err, }; @@ -2162,7 +2159,7 @@ pub const ModuleDebugInfo = switch (native_os) { } fn loadOFile(self: *@This(), allocator: mem.Allocator, o_file_path: []const u8) !*OFileInfo { - const o_file = try fs.cwd().openFile(o_file_path, .{ .intended_io_mode = .blocking }); + const o_file = try fs.cwd().openFile(o_file_path, .{}); const mapped_mem = try mapWholeFile(o_file); const hdr: *const macho.mach_header_64 = @ptrCast(@alignCast(mapped_mem.ptr)); |
