| ... | ... | @@ -297,7 +297,19 @@ const Module = struct { |
| 297 | 297 | // a binary is produced with -gdwarf, since the section names are longer than 8 bytes. |
| 298 | 298 | const mapped_file: ?DebugInfo.MappedFile = mapped: { |
| 299 | 299 | if (!coff_obj.strtabRequired()) break :mapped null; |
| 300 | | const coff_file = Io.File.openSelfExe(io, .{}) catch |err| switch (err) { |
| 300 | var name_buffer: [windows.PATH_MAX_WIDE + 4:0]u16 = undefined; |
| 301 | name_buffer[0..4].* = .{ '\\', '?', '?', '\\' }; // openFileAbsoluteW requires the prefix to be present |
| 302 | const process_handle = windows.GetCurrentProcess(); |
| 303 | const len = windows.kernel32.GetModuleFileNameExW( |
| 304 | process_handle, |
| 305 | module.handle, |
| 306 | name_buffer[4..], |
| 307 | windows.PATH_MAX_WIDE, |
| 308 | ); |
| 309 | if (len == 0) return error.MissingDebugInfo; |
| 310 | const name_w = name_buffer[0 .. len + 4 :0]; |
| 311 | var threaded: Io.Threaded = .init_single_threaded; |
| 312 | const coff_file = threaded.dirOpenFileWtf16(null, name_w, .{}) catch |err| switch (err) { |
| 301 | 313 | error.Canceled => |e| return e, |
| 302 | 314 | error.Unexpected => |e| return e, |
| 303 | 315 | error.FileNotFound => return error.MissingDebugInfo, |
| ... | ... | @@ -327,12 +339,6 @@ const Module = struct { |
| 327 | 339 | error.SystemFdQuotaExceeded, |
| 328 | 340 | error.FileLocksNotSupported, |
| 329 | 341 | error.FileBusy, |
| 330 | | error.InputOutput, |
| 331 | | error.NotSupported, |
| 332 | | error.FileSystem, |
| 333 | | error.NotLink, |
| 334 | | error.UnrecognizedVolume, |
| 335 | | error.UnknownName, |
| 336 | 342 | => return error.ReadFailed, |
| 337 | 343 | }; |
| 338 | 344 | errdefer coff_file.close(io); |
| ... | ... | @@ -352,7 +358,6 @@ const Module = struct { |
| 352 | 358 | errdefer windows.CloseHandle(section_handle); |
| 353 | 359 | var coff_len: usize = 0; |
| 354 | 360 | var section_view_ptr: ?[*]const u8 = null; |
| 355 | | const process_handle = windows.GetCurrentProcess(); |
| 356 | 361 | const map_section_rc = windows.ntdll.NtMapViewOfSection( |
| 357 | 362 | section_handle, |
| 358 | 363 | process_handle, |