From 95c43e20b45aafa6b34b0aae927dbabbb0b65e32 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sat, 18 Jun 2022 01:12:47 -0700 Subject: Windows: Fix incorrect output when .pdb file is not found during stack trace This `pdb.Pdb.init` call can return `error.FileNotFound`, which was previously resulting in: Unable to print stack trace: FileNotFound which also aborts the stack trace printing (so any deeper stack traces are not printed). It makes more sense to treat it as `MissingDebugInfo` which then gets printed as: ???:?:?: 0x7fffa8817033 in ??? (???) and allows the stack trace to continue printing. Note: locally, the error.FileNotFound was being triggered for me when looking for kernel32.pdb and ntdll.pdb --- lib/std/debug.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/std/debug.zig') diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 3ce9f3c1d3..5e217890b7 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -864,7 +864,10 @@ fn readCoffDebugInfo(allocator: mem.Allocator, coff_file: File) !ModuleDebugInfo defer allocator.free(path); di.debug_data = PdbOrDwarf{ .pdb = undefined }; - di.debug_data.pdb = try pdb.Pdb.init(allocator, path); + di.debug_data.pdb = pdb.Pdb.init(allocator, path) catch |err| switch (err) { + error.FileNotFound, error.IsDir => return error.MissingDebugInfo, + else => return err, + }; try di.debug_data.pdb.parseInfoStream(); try di.debug_data.pdb.parseDbiStream(); -- cgit v1.2.3