def get_type_tokens_after_name( self, type: types.Type, platform: Optional[_platform.Platform] = None, base_confidence: int = core.max_confidence, parent_type: Optional[types.Type] = None, escaping: TokenEscapingType = TokenEscapingType. BackticksTokenEscapingType ) -> List[_function.InstructionTextToken]: count = ctypes.c_ulonglong() result_cpp = ctypes.POINTER(core.BNInstructionTextToken)() parent_type_cpp = None if parent_type is not None: parent_type_cpp = parent_type.handle if not core.BNGetTypePrinterTypeTokensAfterName( self.handle, type.handle, None if platform is None else platform.handle, base_confidence, parent_type_cpp, ctypes.c_int(escaping), result_cpp, count): raise RuntimeError( "BNGetTypePrinterTypeTokensAfterName returned False") result = _function.InstructionTextToken._from_core_struct( result_cpp, count.value) core.BNFreeInstructionText(result_cpp.contents, count.value) return result
def get_tokens_after_name(self, base_confidence = max_confidence): count = ctypes.c_ulonglong() platform = None if self.platform is not None: platform = self.platform.handle tokens = core.BNGetTypeTokensAfterName(self.handle, platform, base_confidence, count) result = binaryninja.function.InstructionTextToken.get_instruction_lines(tokens, count.value) core.BNFreeInstructionText(tokens, count.value) return result
def get_tokens_before_name(self, base_confidence = max_confidence): count = ctypes.c_ulonglong() platform = None if self._platform is not None: platform = self._platform.handle if self._mutable: tokens = core.BNGetTypeBuilderTokensBeforeName(self._handle, platform, base_confidence, count) else: tokens = core.BNGetTypeTokensBeforeName(self._handle, platform, base_confidence, count) result = binaryninja.function.InstructionTextToken.get_instruction_lines(tokens, count.value) core.BNFreeInstructionText(tokens, count.value) return result
def tokens(self): """MLIL tokens (read-only)""" count = ctypes.c_ulonglong() tokens = ctypes.POINTER(core.BNInstructionTextToken)() if ((self.instr_index is not None) and (self.function.source_function is not None) and (self.expr_index == core.BNGetMediumLevelILIndexForInstruction(self.function.handle, self.instr_index))): if not core.BNGetMediumLevelILInstructionText(self.function.handle, self.function.source_function.handle, self.function.arch.handle, self.instr_index, tokens, count): return None else: if not core.BNGetMediumLevelILExprText(self.function.handle, self.function.arch.handle, self.expr_index, tokens, count): return None result = binaryninja.function.InstructionTextToken.get_instruction_lines(tokens, count.value) core.BNFreeInstructionText(tokens, count.value) return result
def get_type_tokens( self, type: types.Type, platform: Optional[_platform.Platform] = None, name: types.QualifiedNameType = "", base_confidence: int = core.max_confidence, escaping: TokenEscapingType = TokenEscapingType. BackticksTokenEscapingType ) -> List[_function.InstructionTextToken]: if not isinstance(name, types.QualifiedName): name = types.QualifiedName(name) count = ctypes.c_ulonglong() name_cpp = name._to_core_struct() result_cpp = ctypes.POINTER(core.BNInstructionTextToken)() if not core.BNGetTypePrinterTypeTokens( self.handle, type.handle, None if platform is None else platform.handle, name_cpp, base_confidence, ctypes.c_int(escaping), result_cpp, count): raise RuntimeError("BNGetTypePrinterTypeTokens returned False") result = _function.InstructionTextToken._from_core_struct( result_cpp, count.value) core.BNFreeInstructionText(result_cpp.contents, count.value) return result