| ... | @@ -2707,7 +2707,15 @@ fn writeDebugInfo(self: *Zld) !void { | ... | @@ -2707,7 +2707,15 @@ fn writeDebugInfo(self: *Zld) !void { |
| 2707 | }; | 2707 | }; |
| 2708 | defer debug_info.deinit(self.allocator); | 2708 | defer debug_info.deinit(self.allocator); |
| 2709 | | 2709 | |
| 2710 | const compile_unit = try debug_info.inner.findCompileUnit(0x0); // We assume there is only one CU. | 2710 | // We assume there is only one CU. |
| | 2711 | const compile_unit = debug_info.inner.findCompileUnit(0x0) catch |err| switch (err) { |
| | 2712 | error.MissingDebugInfo => { |
| | 2713 | // TODO audit cases with missing debug info and audit our dwarf.zig module. |
| | 2714 | log.debug("invalid or missing debug info in {s}; skipping", .{object.name}); |
| | 2715 | continue; |
| | 2716 | }, |
| | 2717 | else => |e| return e, |
| | 2718 | }; |
| 2711 | const name = try compile_unit.die.getAttrString(&debug_info.inner, dwarf.AT_name); | 2719 | const name = try compile_unit.die.getAttrString(&debug_info.inner, dwarf.AT_name); |
| 2712 | const comp_dir = try compile_unit.die.getAttrString(&debug_info.inner, dwarf.AT_comp_dir); | 2720 | const comp_dir = try compile_unit.die.getAttrString(&debug_info.inner, dwarf.AT_comp_dir); |
| 2713 | | 2721 | |