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

Method get_hlil_var_refs

python/function.py:3229–3258  ·  view source on GitHub ↗

``get_hlil_var_refs`` returns a list of ILReferenceSource objects (IL xrefs or cross-references) that reference the given variable. The variable is a local variable that can be either on the stack, in a register, or in a flag. :param Variable var: Variable for which to query the xref :re

(self, var: 'variable.Variable')

Source from the content-addressed store, hash-verified

3227 return result
3228
3229 def get_hlil_var_refs(self, var: 'variable.Variable') -> List[ILReferenceSource]:
3230 """
3231 ``get_hlil_var_refs`` returns a list of ILReferenceSource objects (IL xrefs or cross-references)
3232 that reference the given variable. The variable is a local variable that can be either on the stack,
3233 in a register, or in a flag.
3234
3235 :param Variable var: Variable for which to query the xref
3236 :return: List of IL References for the given variable
3237 :rtype: list(ILReferenceSource)
3238 :Example:
3239
3240 >>> mlil_var = current_hlil[0].operands[0]
3241 >>> current_function.get_hlil_var_refs(mlil_var)
3242 """
3243 count = ctypes.c_ulonglong(0)
3244 refs = core.BNGetHighLevelILVariableReferences(self.handle, var.to_BNVariable(), count)
3245 assert refs is not None, "core.BNGetHighLevelILVariableReferences returned None"
3246 result = []
3247 for i in range(0, count.value):
3248 if refs[i].func:
3249 func = Function(self.view, core.BNNewFunctionReference(refs[i].func))
3250 else:
3251 func = None
3252 if refs[i].arch:
3253 arch = architecture.CoreArchitecture._from_cache(refs[i].arch)
3254 else:
3255 arch = None
3256 result.append(ILReferenceSource(func, arch, refs[i].addr, refs[i].type, refs[i].exprId))
3257 core.BNFreeILReferences(refs, count.value)
3258 return result
3259
3260 def get_hlil_var_refs_from(self, addr: int, length: Optional[int] = None,
3261 arch: Optional['architecture.Architecture'] = None) -> List[VariableReferenceSource]:

Callers

nothing calls this directly

Calls 5

to_BNVariableMethod · 0.80
FunctionClass · 0.70
ILReferenceSourceClass · 0.70
_from_cacheMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected