def make_function_prehook(self, object_version, address): address = object_version.get_object_address() size = object_version.get_size() try: thumb_flag = object_version.get_attributes()['thumb_mode_flag'] except KeyError: thumb_flag = None current_thumb_flag = idaapi.getSR(address, self.thumb_segment_register) logger.debug("make_function_prehook:thumb_flag = %d (vs %s in cache)" % (current_thumb_flag, thumb_flag)) if thumb_flag is not None and current_thumb_flag != thumb_flag: idaapi.set_sreg_at_next_code(address, address + size, self.thumb_segment_register, int(thumb_flag))
def isThumb(ea): global thumbRegId return idaapi.getSR(ea, thumbRegId) != 0
def accept_function_hook(self, visitor, eaFunc, func, basic_blocks=None): startEA = eaFunc thumb_flag = idaapi.getSR(startEA, self.thumb_segment_register) visitor.visit_attribute("thumb_mode_flag", str(thumb_flag))
def accept_basic_block_hook(self, visitor, basic_block, funcEA, func, parent_function_id): startEA = basic_block['startEA'] thumb_flag = idaapi.getSR(startEA, self.thumb_segment_register) visitor.visit_attribute("thumb_mode_flag", str(thumb_flag))