From 10b10177025790ffa84304f282e8323ea2b10c37 Mon Sep 17 00:00:00 2001 From: emekoi Date: Sat, 27 Jul 2019 17:50:44 -0500 Subject: [PATCH] fixed backtraces when linking libc on mingw --- std/coff.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/std/coff.zig b/std/coff.zig index 9fdc368878..7c53f48f66 100644 --- a/std/coff.zig +++ b/std/coff.zig @@ -120,7 +120,15 @@ pub const Coff = struct { pub fn getPdbPath(self: *Coff, buffer: []u8) !usize { try self.loadSections(); - const header = (self.getSection(".rdata") orelse return error.MissingCoffSection).header; + const header = blk: { + if (self.getSection(".buildid")) |section| { + break :blk section.header; + } else if (self.getSection(".rdata")) |section| { + break :blk section.header; + } else { + return error.MissingCoffSection; + } + }; // The linker puts a chunk that contains the .pdb path right after the // debug_directory.