``get_mlil_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. This function is related to get_hlil_var_refs(), which returns v
(self, var: 'variable.Variable')
| 3147 | return core.BNGetProvenanceString(self.handle) |
| 3148 | |
| 3149 | def get_mlil_var_refs(self, var: 'variable.Variable') -> List[ILReferenceSource]: |
| 3150 | """ |
| 3151 | ``get_mlil_var_refs`` returns a list of ILReferenceSource objects (IL xrefs or cross-references) |
| 3152 | that reference the given variable. The variable is a local variable that can be either on the stack, |
| 3153 | in a register, or in a flag. |
| 3154 | This function is related to get_hlil_var_refs(), which returns variable references collected |
| 3155 | from HLIL. The two can be different in several cases, e.g., multiple variables in MLIL can be merged |
| 3156 | into a single variable in HLIL. |
| 3157 | |
| 3158 | :param Variable var: Variable for which to query the xref |
| 3159 | :return: List of IL References for the given variable |
| 3160 | :rtype: list(ILReferenceSource) |
| 3161 | :Example: |
| 3162 | |
| 3163 | >>> mlil_var = current_mlil[0].operands[0] |
| 3164 | >>> current_function.get_mlil_var_refs(mlil_var) |
| 3165 | """ |
| 3166 | count = ctypes.c_ulonglong(0) |
| 3167 | refs = core.BNGetMediumLevelILVariableReferences(self.handle, var.to_BNVariable(), count) |
| 3168 | assert refs is not None, "core.BNGetMediumLevelILVariableReferences returned None" |
| 3169 | result = [] |
| 3170 | for i in range(0, count.value): |
| 3171 | if refs[i].func: |
| 3172 | func = Function(self.view, core.BNNewFunctionReference(refs[i].func)) |
| 3173 | else: |
| 3174 | func = None |
| 3175 | if refs[i].arch: |
| 3176 | arch = architecture.CoreArchitecture._from_cache(refs[i].arch) |
| 3177 | else: |
| 3178 | arch = None |
| 3179 | |
| 3180 | result.append(ILReferenceSource(func, arch, refs[i].addr, refs[i].type, refs[i].exprId)) |
| 3181 | core.BNFreeILReferences(refs, count.value) |
| 3182 | return result |
| 3183 | |
| 3184 | def get_mlil_var_refs_from(self, addr: int, length: Optional[int] = None, |
| 3185 | arch: Optional['architecture.Architecture'] = None) -> List[VariableReferenceSource]: |
nothing calls this directly
no test coverage detected