| ... | @@ -1184,31 +1184,11 @@ pub fn commitDeclState( | ... | @@ -1184,31 +1184,11 @@ pub fn commitDeclState( |
| 1184 | }, | 1184 | }, |
| 1185 | | 1185 | |
| 1186 | .macho => { | 1186 | .macho => { |
| 1187 | const macho_file = self.bin_file.cast(File.MachO).?; | 1187 | const d_sym = self.bin_file.cast(File.MachO).?.getDebugSymbols().?; |
| 1188 | const d_sym = &macho_file.d_sym.?; | 1188 | const sect_index = d_sym.debug_line_section_index.?; |
| 1189 | const debug_line_sect = d_sym.getSectionPtr(d_sym.debug_line_section_index.?); | 1189 | try d_sym.growSection(sect_index, needed_size); |
| 1190 | if (needed_size != debug_line_sect.size) { | 1190 | const sect = d_sym.getSection(sect_index); |
| 1191 | if (needed_size > d_sym.allocatedSize(debug_line_sect.offset)) { | 1191 | const file_pos = sect.offset + src_fn.off; |
| 1192 | const new_offset = d_sym.findFreeSpace(needed_size, 1); | | |
| 1193 | const existing_size = last_src_fn.off; | | |
| 1194 | std.log.scoped(.dsym).debug("moving __debug_line section: {} bytes from 0x{x} to 0x{x}", .{ | | |
| 1195 | existing_size, | | |
| 1196 | debug_line_sect.offset, | | |
| 1197 | new_offset, | | |
| 1198 | }); | | |
| 1199 | const amt = try d_sym.file.copyRangeAll( | | |
| 1200 | debug_line_sect.offset, | | |
| 1201 | d_sym.file, | | |
| 1202 | new_offset, | | |
| 1203 | existing_size, | | |
| 1204 | ); | | |
| 1205 | if (amt != existing_size) return error.InputOutput; | | |
| 1206 | debug_line_sect.offset = @intCast(u32, new_offset); | | |
| 1207 | } | | |
| 1208 | debug_line_sect.size = needed_size; | | |
| 1209 | d_sym.debug_line_header_dirty = true; | | |
| 1210 | } | | |
| 1211 | const file_pos = debug_line_sect.offset + src_fn.off; | | |
| 1212 | try pwriteDbgLineNops( | 1192 | try pwriteDbgLineNops( |
| 1213 | d_sym.file, | 1193 | d_sym.file, |
| 1214 | file_pos, | 1194 | file_pos, |