def GetKextSymbolInfo(load_addr): """ Get a string descriptiong load_addr <kextname> + offset params: load_addr - int address value of pc in backtrace. returns: str - kext name + offset string. If no cached data available, warning message is returned. """ symbol_name = "None" symbol_offset = load_addr kmod_val = kern.globals.kmod if not kern.arch.startswith('arm64'): for kval in IterateLinkedList(kmod_val, 'next'): if load_addr >= unsigned(kval.address) and \ load_addr <= (unsigned(kval.address) + unsigned(kval.size)): symbol_name = kval.name symbol_offset = load_addr - unsigned(kval.address) break return "{:#018x} {:s} + {:#x} \n".format(load_addr, symbol_name, symbol_offset) # only for arm64 we do lookup for split kexts. cached_kext_info = caching.GetDynamicCacheData("kern.kexts.loadinformation", []) if not cached_kext_info and str(GetConnectionProtocol()) == "core": cached_kext_info = GetKextLoadInformation() if not cached_kext_info: return "{:#018x} ~ kext info not available. please run 'showallkexts' once ~ \n".format(load_addr) for kval in cached_kext_info: text_seg = kval[5] if load_addr >= text_seg.vmaddr and \ load_addr <= (text_seg.vmaddr + text_seg.vmsize): symbol_name = kval[2] symbol_offset = load_addr - text_seg.vmaddr break return "{:#018x} {:s} + {:#x} \n".format(load_addr, symbol_name, symbol_offset)
def readMemory(self, address, size): cache_key = "{}-{}-{}".format(hex(self.task), hex(address), size) cache_data = caching.GetDynamicCacheData(cache_key) if cache_data: return self.encodeByteString(cache_data) data = GetUserDataAsString(self.task, address, size) if not data: logging.error( "Failed to read memory task:{: <#018x} {: <#018x} {:d}".format( self.task, address, size)) else: caching.SaveDynamicCacheData(cache_key, data) return self.encodeByteString(data)