MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / _from_core_struct

Method _from_core_struct

python/architecture.py:2859–2886  ·  view source on GitHub ↗
(tokens: 'ctypes.pointer[core.BNInstructionTextToken]',
	                      count: int)

Source from the content-addressed store, hash-verified

2857
2858 @staticmethod
2859 def _from_core_struct(tokens: 'ctypes.pointer[core.BNInstructionTextToken]',
2860 count: int) -> List['InstructionTextToken']:
2861 result: List['InstructionTextToken'] = []
2862 for j in range(count):
2863 token_type = InstructionTextTokenType(tokens[j].type)
2864 text = tokens[j].text
2865 if not isinstance(text, str):
2866 text = text.decode("utf-8")
2867 width = tokens[j].width
2868 value = tokens[j].value
2869 size = tokens[j].size
2870 operand = tokens[j].operand
2871 context = tokens[j].context
2872 confidence = tokens[j].confidence
2873 address = tokens[j].address
2874 il_expr_index = tokens[j].exprIndex
2875 typeNames = []
2876 for i in range(tokens[j].namesCount):
2877 if not isinstance(tokens[j].typeNames[i], str):
2878 typeNames.append(tokens[j].typeNames[i].decode("utf-8"))
2879 else:
2880 typeNames.append(tokens[j].typeNames[i])
2881 result.append(
2882 InstructionTextToken(
2883 token_type, text, value, size, operand, context, address, confidence, typeNames, width, il_expr_index
2884 )
2885 )
2886 return result
2887
2888 @staticmethod
2889 def _get_core_struct(tokens: List['InstructionTextToken']) -> 'ctypes.Array[core.BNInstructionTextToken]':

Callers 1

get_instruction_textMethod · 0.45

Calls 3

decodeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected