我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用idaapi.processor_t()。
def __init__(self): idaapi.processor_t.__init__(self) # TODO: logging not working. # self.work_folder = "" # self.log_fn = self.work_folder + 'work.log' # logging.basicConfig(filename=self.log_fn, level=logging.DEBUG, filemode='w') # self.logger = open(self.log_fn, 'w') self.relocatable_file = re.search(r'\.o$', GetInputFile()) != None self.init_instructions() self.prev_addr_analyzed = -1 self.current_hex_packet = None self.hd = HexagonDisassembler() # TODO: this should be instatiated on demand, because I think the init is called every time IDA starts self.disasm_cache = {} # TODO: use orderdict to remove old entries self.profiler = cProfile.Profile() hexagondisasm.profiler = self.profiler # TODO: I don't know how to access this class from the IDA Python # console to get the profiler, I do it through the module
def __init__(self): idaapi.processor_t.__init__(self) self.init_instructions(self.processor) self.init_registers() self.reorderdelayed = False # big endian default idaapi.cvar.inf.mf = 1 # ---------------------------------------------------------------------- # Every processor module script must provide this function. # It should return a new instance of a class derived from idaapi.processor_t