Type Function getOFileInfoForAddress [src]

Prototype

pub fn getOFileInfoForAddress(self: *@This(), allocator: Allocator, address: usize) !struct { relocated_address: usize, symbol: ?*const MachoSymbol = null, o_file_info: ?*OFileInfo = null, }

Parameters

self: *@This()allocator: Allocatoraddress: usize

Source

pub fn getOFileInfoForAddress(self: *@This(), allocator: Allocator, address: usize) !struct { relocated_address: usize, symbol: ?*const MachoSymbol = null, o_file_info: ?*OFileInfo = null, } { nosuspend { // Translate the VA into an address into this object const relocated_address = address - self.vmaddr_slide; // Find the .o file where this symbol is defined const symbol = machoSearchSymbols(self.symbols, relocated_address) orelse return .{ .relocated_address = relocated_address, }; // Check if its debug infos are already in the cache const o_file_path = mem.sliceTo(self.strings[symbol.ofile..], 0); const o_file_info = self.ofiles.getPtr(o_file_path) orelse (self.loadOFile(allocator, o_file_path) catch |err| switch (err) { error.FileNotFound, error.MissingDebugInfo, error.InvalidDebugInfo, => return .{ .relocated_address = relocated_address, .symbol = symbol, }, else => return err, }); return .{ .relocated_address = relocated_address, .symbol = symbol, .o_file_info = o_file_info, }; } }