``get_hlil_var_refs_from`` returns a list of variables referenced by code in the function ``func``, of the architecture ``arch``, and at the address ``addr``. If no function is specified, references from all functions and containing the address will be returned. If no architecture is specifie
(self, addr: int, length: Optional[int] = None, arch: Optional['architecture.Architecture'] = None)
| 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]: |
| 3262 | """ |
| 3263 | ``get_hlil_var_refs_from`` returns a list of variables referenced by code in the function ``func``, |
| 3264 | of the architecture ``arch``, and at the address ``addr``. If no function is specified, references from |
| 3265 | all functions and containing the address will be returned. If no architecture is specified, the |
| 3266 | architecture of the function will be used. |
| 3267 | |
| 3268 | :param int addr: virtual address to query for variable references |
| 3269 | :param int length: optional length of query |
| 3270 | :param Architecture arch: optional architecture of query |
| 3271 | :return: list of variables reference sources |
| 3272 | :rtype: list(VariableReferenceSource) |
| 3273 | """ |
| 3274 | result = [] |
| 3275 | count = ctypes.c_ulonglong(0) |
| 3276 | if arch is None: |
| 3277 | arch = self.arch |
| 3278 | if length is None: |
| 3279 | refs = core.BNGetHighLevelILVariableReferencesFrom(self.handle, arch.handle, addr, count) |
| 3280 | assert refs is not None, "core.BNGetHighLevelILVariableReferencesFrom returned None" |
| 3281 | else: |
| 3282 | refs = core.BNGetHighLevelILVariableReferencesInRange(self.handle, arch.handle, addr, length, count) |
| 3283 | assert refs is not None, "core.BNGetHighLevelILVariableReferencesInRange returned None" |
| 3284 | for i in range(0, count.value): |
| 3285 | var = variable.Variable.from_BNVariable(self, refs[i].var) |
| 3286 | if refs[i].source.func: |
| 3287 | func = Function(self.view, core.BNNewFunctionReference(refs[i].source.func)) |
| 3288 | else: |
| 3289 | func = None |
| 3290 | if refs[i].source.arch: |
| 3291 | _arch = architecture.CoreArchitecture._from_cache(refs[i].source.arch) |
| 3292 | else: |
| 3293 | _arch = arch |
| 3294 | |
| 3295 | src = ILReferenceSource(func, _arch, refs[i].source.addr, refs[i].source.type, refs[i].source.exprId) |
| 3296 | result.append(VariableReferenceSource(var, src)) |
| 3297 | core.BNFreeVariableReferenceSourceList(refs, count.value) |
| 3298 | return result |
| 3299 | |
| 3300 | def get_instruction_containing_address(self, addr: int, |
| 3301 | arch: Optional['architecture.Architecture'] = None) -> Optional[int]: |
nothing calls this directly
no test coverage detected