| ... | @@ -531,7 +531,7 @@ pub fn updateFunc( | ... | @@ -531,7 +531,7 @@ pub fn updateFunc( |
| 531 | var code_buffer = std.ArrayList(u8).init(gpa); | 531 | var code_buffer = std.ArrayList(u8).init(gpa); |
| 532 | defer code_buffer.deinit(); | 532 | defer code_buffer.deinit(); |
| 533 | | 533 | |
| 534 | var decl_state: ?Dwarf.DeclState = null; // TODO: Dwarf | 534 | var decl_state: ?Dwarf.DeclState = if (macho_file.getDebugSymbols()) |d_sym| try d_sym.dwarf.initDeclState(mod, decl_index) else null; |
| 535 | defer if (decl_state) |*ds| ds.deinit(); | 535 | defer if (decl_state) |*ds| ds.deinit(); |
| 536 | | 536 | |
| 537 | const dio: codegen.DebugInfoOutput = if (decl_state) |*ds| .{ .dwarf = ds } else .none; | 537 | const dio: codegen.DebugInfoOutput = if (decl_state) |*ds| .{ .dwarf = ds } else .none; |
| ... | @@ -557,16 +557,16 @@ pub fn updateFunc( | ... | @@ -557,16 +557,16 @@ pub fn updateFunc( |
| 557 | const sect_index = try self.getDeclOutputSection(macho_file, decl, code); | 557 | const sect_index = try self.getDeclOutputSection(macho_file, decl, code); |
| 558 | try self.updateDeclCode(macho_file, decl_index, sym_index, sect_index, code); | 558 | try self.updateDeclCode(macho_file, decl_index, sym_index, sect_index, code); |
| 559 | | 559 | |
| 560 | // if (decl_state) |*ds| { | 560 | if (decl_state) |*ds| { |
| 561 | // const sym = elf_file.symbol(sym_index); | 561 | const sym = macho_file.getSymbol(sym_index); |
| 562 | // try self.dwarf.?.commitDeclState( | 562 | try macho_file.getDebugSymbols().?.dwarf.commitDeclState( |
| 563 | // mod, | 563 | mod, |
| 564 | // decl_index, | 564 | decl_index, |
| 565 | // sym.value, | 565 | sym.getAddress(.{}, macho_file), |
| 566 | // sym.atom(elf_file).?.size, | 566 | sym.getAtom(macho_file).?.size, |
| 567 | // ds, | 567 | ds, |
| 568 | // ); | 568 | ); |
| 569 | // } | 569 | } |
| 570 | | 570 | |
| 571 | // Since we updated the vaddr and the size, each corresponding export | 571 | // Since we updated the vaddr and the size, each corresponding export |
| 572 | // symbol also needs to be updated. | 572 | // symbol also needs to be updated. |
| ... | @@ -606,7 +606,7 @@ pub fn updateDecl( | ... | @@ -606,7 +606,7 @@ pub fn updateDecl( |
| 606 | var code_buffer = std.ArrayList(u8).init(gpa); | 606 | var code_buffer = std.ArrayList(u8).init(gpa); |
| 607 | defer code_buffer.deinit(); | 607 | defer code_buffer.deinit(); |
| 608 | | 608 | |
| 609 | var decl_state: ?Dwarf.DeclState = null; // TODO: Dwarf | 609 | var decl_state: ?Dwarf.DeclState = if (macho_file.getDebugSymbols()) |d_sym| try d_sym.dwarf.initDeclState(mod, decl_index) else null; |
| 610 | defer if (decl_state) |*ds| ds.deinit(); | 610 | defer if (decl_state) |*ds| ds.deinit(); |
| 611 | | 611 | |
| 612 | const decl_val = if (decl.val.getVariable(mod)) |variable| Value.fromInterned(variable.init) else decl.val; | 612 | const decl_val = if (decl.val.getVariable(mod)) |variable| Value.fromInterned(variable.init) else decl.val; |
| ... | @@ -638,15 +638,16 @@ pub fn updateDecl( | ... | @@ -638,15 +638,16 @@ pub fn updateDecl( |
| 638 | try self.updateDeclCode(macho_file, decl_index, sym_index, sect_index, code); | 638 | try self.updateDeclCode(macho_file, decl_index, sym_index, sect_index, code); |
| 639 | } | 639 | } |
| 640 | | 640 | |
| 641 | // if (decl_state) |*ds| { | 641 | if (decl_state) |*ds| { |
| 642 | // try self.d_sym.?.dwarf.commitDeclState( | 642 | const sym = macho_file.getSymbol(sym_index); |
| 643 | // mod, | 643 | try macho_file.getDebugSymbols().?.dwarf.commitDeclState( |
| 644 | // decl_index, | 644 | mod, |
| 645 | // addr, | 645 | decl_index, |
| 646 | // self.getAtom(atom_index).size, | 646 | sym.getAddress(.{}, macho_file), |
| 647 | // ds, | 647 | sym.getAtom(macho_file).?.size, |
| 648 | // ); | 648 | ds, |
| 649 | // } | 649 | ); |
| | 650 | } |
| 650 | | 651 | |
| 651 | // Since we updated the vaddr and the size, each corresponding export symbol also | 652 | // Since we updated the vaddr and the size, each corresponding export symbol also |
| 652 | // needs to be updated. | 653 | // needs to be updated. |
| ... | @@ -1220,13 +1221,14 @@ fn updateLazySymbol( | ... | @@ -1220,13 +1221,14 @@ fn updateLazySymbol( |
| 1220 | /// Must be called only after a successful call to `updateDecl`. | 1221 | /// Must be called only after a successful call to `updateDecl`. |
| 1221 | pub fn updateDeclLineNumber( | 1222 | pub fn updateDeclLineNumber( |
| 1222 | self: *ZigObject, | 1223 | self: *ZigObject, |
| | 1224 | macho_file: *MachO, |
| 1223 | mod: *Module, | 1225 | mod: *Module, |
| 1224 | decl_index: InternPool.DeclIndex, | 1226 | decl_index: InternPool.DeclIndex, |
| 1225 | ) !void { | 1227 | ) !void { |
| 1226 | _ = self; | 1228 | _ = self; |
| 1227 | _ = mod; | 1229 | if (macho_file.getDebugSymbols()) |d_sym| { |
| 1228 | _ = decl_index; | 1230 | try d_sym.dwarf.updateDeclLineNumber(mod, decl_index); |
| 1229 | // TODO: Dwarf | 1231 | } |
| 1230 | } | 1232 | } |
| 1231 | | 1233 | |
| 1232 | pub fn deleteDeclExport( | 1234 | pub fn deleteDeclExport( |