| ... | @@ -2336,16 +2336,13 @@ pub fn writeDbgLineHeader(self: *Dwarf, module: *Module) !void { | ... | @@ -2336,16 +2336,13 @@ pub fn writeDbgLineHeader(self: *Dwarf, module: *Module) !void { |
| 2336 | const delta = needed_with_padding - dbg_line_prg_off; | 2336 | const delta = needed_with_padding - dbg_line_prg_off; |
| 2337 | | 2337 | |
| 2338 | const d_sym = self.bin_file.cast(File.MachO).?.getDebugSymbols().?; | 2338 | const d_sym = self.bin_file.cast(File.MachO).?.getDebugSymbols().?; |
| 2339 | const debug_line_sect = d_sym.getSectionPtr(d_sym.debug_line_section_index.?); | 2339 | const sect_index = d_sym.debug_line_section_index.?; |
| 2340 | const needed_size = debug_line_sect.size + delta; | 2340 | const needed_size = @intCast(u32, d_sym.getSection(sect_index).size + delta); |
| 2341 | | 2341 | try d_sym.growSection(sect_index, needed_size); |
| 2342 | if (needed_size > d_sym.allocatedSize(debug_line_sect.offset)) { | | |
| 2343 | @panic("TODO grow debug_line section"); | | |
| 2344 | } | | |
| 2345 | | 2342 | |
| 2346 | var src_fn = self.dbg_line_fn_first.?; | 2343 | var src_fn = self.dbg_line_fn_first.?; |
| 2347 | const last_fn = self.dbg_line_fn_last.?; | 2344 | const last_fn = self.dbg_line_fn_last.?; |
| 2348 | const file_pos = debug_line_sect.offset + src_fn.off; | 2345 | const file_pos = d_sym.getSection(sect_index).offset + src_fn.off; |
| 2349 | | 2346 | |
| 2350 | var buffer = try gpa.alloc(u8, last_fn.off + last_fn.len - src_fn.off); | 2347 | var buffer = try gpa.alloc(u8, last_fn.off + last_fn.len - src_fn.off); |
| 2351 | defer gpa.free(buffer); | 2348 | defer gpa.free(buffer); |
| ... | @@ -2354,8 +2351,6 @@ pub fn writeDbgLineHeader(self: *Dwarf, module: *Module) !void { | ... | @@ -2354,8 +2351,6 @@ pub fn writeDbgLineHeader(self: *Dwarf, module: *Module) !void { |
| 2354 | | 2351 | |
| 2355 | try d_sym.file.pwriteAll(buffer, file_pos + delta); | 2352 | try d_sym.file.pwriteAll(buffer, file_pos + delta); |
| 2356 | | 2353 | |
| 2357 | debug_line_sect.size = needed_size; | | |
| 2358 | | | |
| 2359 | while (true) { | 2354 | while (true) { |
| 2360 | src_fn.off += delta; | 2355 | src_fn.off += delta; |
| 2361 | | 2356 | |