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