| ... | ... | @@ -602,10 +602,11 @@ pub const Module = switch (native_os) { |
| 602 | 602 | sections[@intFromEnum(Dwarf.Section.Id.debug_line)] == null; |
| 603 | 603 | if (missing_debug_info) return error.MissingDebugInfo; |
| 604 | 604 | |
| 605 | | var di = Dwarf{ |
| 605 | var di: Dwarf = .{ |
| 606 | 606 | .endian = .little, |
| 607 | 607 | .sections = sections, |
| 608 | 608 | .is_macho = true, |
| 609 | .compile_units_sorted = false, |
| 609 | 610 | }; |
| 610 | 611 | |
| 611 | 612 | try Dwarf.open(&di, allocator); |
| ... | ... | @@ -622,7 +623,7 @@ pub const Module = switch (native_os) { |
| 622 | 623 | return result.value_ptr; |
| 623 | 624 | } |
| 624 | 625 | |
| 625 | | pub fn getSymbolAtAddress(self: *@This(), allocator: Allocator, address: usize) !Dwarf.SymbolInfo { |
| 626 | pub fn getSymbolAtAddress(self: *@This(), allocator: Allocator, address: usize) !std.debug.Symbol { |
| 626 | 627 | nosuspend { |
| 627 | 628 | const result = try self.getOFileInfoForAddress(allocator, address); |
| 628 | 629 | if (result.symbol == null) return .{}; |
| ... | ... | @@ -630,19 +631,19 @@ pub const Module = switch (native_os) { |
| 630 | 631 | // Take the symbol name from the N_FUN STAB entry, we're going to |
| 631 | 632 | // use it if we fail to find the DWARF infos |
| 632 | 633 | const stab_symbol = mem.sliceTo(self.strings[result.symbol.?.strx..], 0); |
| 633 | | if (result.o_file_info == null) return .{ .symbol_name = stab_symbol }; |
| 634 | if (result.o_file_info == null) return .{ .name = stab_symbol }; |
| 634 | 635 | |
| 635 | 636 | // Translate again the address, this time into an address inside the |
| 636 | 637 | // .o file |
| 637 | 638 | const relocated_address_o = result.o_file_info.?.addr_table.get(stab_symbol) orelse return .{ |
| 638 | | .symbol_name = "???", |
| 639 | .name = "???", |
| 639 | 640 | }; |
| 640 | 641 | |
| 641 | 642 | const addr_off = result.relocated_address - result.symbol.?.addr; |
| 642 | 643 | const o_file_di = &result.o_file_info.?.di; |
| 643 | 644 | if (o_file_di.findCompileUnit(relocated_address_o)) |compile_unit| { |
| 644 | 645 | return .{ |
| 645 | | .symbol_name = o_file_di.getSymbolName(relocated_address_o) orelse "???", |
| 646 | .name = o_file_di.getSymbolName(relocated_address_o) orelse "???", |
| 646 | 647 | .compile_unit_name = compile_unit.die.getAttrString( |
| 647 | 648 | o_file_di, |
| 648 | 649 | std.dwarf.AT.name, |
| ... | ... | @@ -651,9 +652,9 @@ pub const Module = switch (native_os) { |
| 651 | 652 | ) catch |err| switch (err) { |
| 652 | 653 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", |
| 653 | 654 | }, |
| 654 | | .line_info = o_file_di.getLineNumberInfo( |
| 655 | .source_location = o_file_di.getLineNumberInfo( |
| 655 | 656 | allocator, |
| 656 | | compile_unit.*, |
| 657 | compile_unit, |
| 657 | 658 | relocated_address_o + addr_off, |
| 658 | 659 | ) catch |err| switch (err) { |
| 659 | 660 | error.MissingDebugInfo, error.InvalidDebugInfo => null, |
| ... | ... | @@ -662,7 +663,7 @@ pub const Module = switch (native_os) { |
| 662 | 663 | }; |
| 663 | 664 | } else |err| switch (err) { |
| 664 | 665 | error.MissingDebugInfo, error.InvalidDebugInfo => { |
| 665 | | return .{ .symbol_name = stab_symbol }; |
| 666 | return .{ .name = stab_symbol }; |
| 666 | 667 | }, |
| 667 | 668 | else => return err, |
| 668 | 669 | } |
| ... | ... | @@ -760,9 +761,9 @@ pub const Module = switch (native_os) { |
| 760 | 761 | ); |
| 761 | 762 | |
| 762 | 763 | return .{ |
| 763 | | .symbol_name = symbol_name, |
| 764 | .name = symbol_name, |
| 764 | 765 | .compile_unit_name = obj_basename, |
| 765 | | .line_info = opt_line_info, |
| 766 | .source_location = opt_line_info, |
| 766 | 767 | }; |
| 767 | 768 | } |
| 768 | 769 | |
| ... | ... | @@ -991,10 +992,11 @@ fn readCoffDebugInfo(allocator: Allocator, coff_obj: *coff.Coff) !Module { |
| 991 | 992 | } else null; |
| 992 | 993 | } |
| 993 | 994 | |
| 994 | | var dwarf = Dwarf{ |
| 995 | var dwarf: Dwarf = .{ |
| 995 | 996 | .endian = native_endian, |
| 996 | 997 | .sections = sections, |
| 997 | 998 | .is_macho = false, |
| 999 | .compile_units_sorted = false, |
| 998 | 1000 | }; |
| 999 | 1001 | |
| 1000 | 1002 | try Dwarf.open(&dwarf, allocator); |
| ... | ... | @@ -1808,6 +1810,7 @@ fn unwindFrameMachODwarf( |
| 1808 | 1810 | var di: Dwarf = .{ |
| 1809 | 1811 | .endian = native_endian, |
| 1810 | 1812 | .is_macho = true, |
| 1813 | .compile_units_sorted = false, |
| 1811 | 1814 | }; |
| 1812 | 1815 | defer di.deinit(context.allocator); |
| 1813 | 1816 | |