aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug/SelfInfo/Windows.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/debug/SelfInfo/Windows.zig')
-rw-r--r--lib/std/debug/SelfInfo/Windows.zig30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/std/debug/SelfInfo/Windows.zig b/lib/std/debug/SelfInfo/Windows.zig
index ddb6bf73f6..99d3e9f926 100644
--- a/lib/std/debug/SelfInfo/Windows.zig
+++ b/lib/std/debug/SelfInfo/Windows.zig
@@ -149,8 +149,9 @@ pub const UnwindContext = struct {
return ctx.cur.getRegs().bp;
}
};
-pub fn unwindFrame(si: *SelfInfo, gpa: Allocator, context: *UnwindContext) Error!usize {
+pub fn unwindFrame(si: *SelfInfo, gpa: Allocator, io: Io, context: *UnwindContext) Error!usize {
_ = si;
+ _ = io;
_ = gpa;
const current_regs = context.cur.getRegs();
@@ -204,14 +205,14 @@ const Module = struct {
coff_section_headers: []coff.SectionHeader,
const MappedFile = struct {
- file: fs.File,
+ file: Io.File,
section_handle: windows.HANDLE,
section_view: []const u8,
- fn deinit(mf: *const MappedFile) void {
+ fn deinit(mf: *const MappedFile, io: Io) void {
const process_handle = windows.GetCurrentProcess();
assert(windows.ntdll.NtUnmapViewOfSection(process_handle, @constCast(mf.section_view.ptr)) == .SUCCESS);
windows.CloseHandle(mf.section_handle);
- mf.file.close();
+ mf.file.close(io);
}
};
@@ -222,7 +223,7 @@ const Module = struct {
pdb.file_reader.file.close(io);
pdb.deinit();
}
- if (di.mapped_file) |*mf| mf.deinit();
+ if (di.mapped_file) |*mf| mf.deinit(io);
var arena = di.arena.promote(gpa);
arena.deinit();
@@ -314,8 +315,8 @@ const Module = struct {
);
if (len == 0) return error.MissingDebugInfo;
const name_w = name_buffer[0 .. len + 4 :0];
- var threaded: Io.Threaded = .init_single_threaded;
- const coff_file = threaded.dirOpenFileWtf16(null, name_w, .{}) catch |err| switch (err) {
+ // TODO eliminate the reference to Io.Threaded.global_single_threaded here
+ const coff_file = Io.Threaded.global_single_threaded.dirOpenFileWtf16(null, name_w, .{}) catch |err| switch (err) {
error.Canceled => |e| return e,
error.Unexpected => |e| return e,
error.FileNotFound => return error.MissingDebugInfo,
@@ -331,7 +332,6 @@ const Module = struct {
error.SystemResources,
error.WouldBlock,
error.AccessDenied,
- error.ProcessNotFound,
error.PermissionDenied,
error.NoSpaceLeft,
error.DeviceBusy,
@@ -343,7 +343,7 @@ const Module = struct {
error.AntivirusInterference,
error.ProcessFdQuotaExceeded,
error.SystemFdQuotaExceeded,
- error.FileLocksNotSupported,
+ error.FileLocksUnsupported,
error.FileBusy,
=> return error.ReadFailed,
};
@@ -387,12 +387,12 @@ const Module = struct {
const section_view = section_view_ptr.?[0..coff_len];
coff_obj = coff.Coff.init(section_view, false) catch return error.InvalidDebugInfo;
break :mapped .{
- .file = .adaptFromNewApi(coff_file),
+ .file = coff_file,
.section_handle = section_handle,
.section_view = section_view,
};
};
- errdefer if (mapped_file) |*mf| mf.deinit();
+ errdefer if (mapped_file) |*mf| mf.deinit(io);
const coff_image_base = coff_obj.getImageBase();
@@ -432,22 +432,22 @@ const Module = struct {
break :pdb null;
};
const pdb_file_open_result = if (fs.path.isAbsolute(path)) res: {
- break :res std.fs.cwd().openFile(path, .{});
+ break :res Io.Dir.cwd().openFile(io, path, .{});
} else res: {
- const self_dir = fs.selfExeDirPathAlloc(gpa) catch |err| switch (err) {
+ const self_dir = std.process.executableDirPathAlloc(io, gpa) catch |err| switch (err) {
error.OutOfMemory, error.Unexpected => |e| return e,
else => return error.ReadFailed,
};
defer gpa.free(self_dir);
const abs_path = try fs.path.join(gpa, &.{ self_dir, path });
defer gpa.free(abs_path);
- break :res std.fs.cwd().openFile(abs_path, .{});
+ break :res Io.Dir.cwd().openFile(io, abs_path, .{});
};
const pdb_file = pdb_file_open_result catch |err| switch (err) {
error.FileNotFound, error.IsDir => break :pdb null,
else => return error.ReadFailed,
};
- errdefer pdb_file.close();
+ errdefer pdb_file.close(io);
const pdb_reader = try arena.create(Io.File.Reader);
pdb_reader.* = pdb_file.reader(io, try arena.alloc(u8, 4096));