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