diff options
| author | Brian Potchik <brian@vector35.com> | 2021-09-29 15:32:29 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2021-09-29 15:32:29 -0400 |
| commit | 0b581b00eeac232dc89a9b2e64d537f08ddd7a83 (patch) | |
| tree | 93d6c8d2be8241afbb923caa4f2b929861d31198 /python | |
| parent | f09baa20bf7f3d367ad2f3a525b5d5f1843b33f7 (diff) | |
Fix 'get_function_at' API for multi-arch binaries.
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index c5f8b500..1cf3a62d 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -3506,13 +3506,18 @@ class BinaryView: >>> """ if plat is None: - plat = self.platform - if plat is None: - return None - func = core.BNGetAnalysisFunction(self.handle, plat.handle, addr) - if func is None: - return None - return _function.Function(self, func) + funcs = self.get_functions_at(addr) + if not funcs: + return None + result = [func for func in funcs if (func.platform == self.platform)] + if not result: + result = funcs + return result[0] + else: + func = core.BNGetAnalysisFunction(self.handle, plat.handle, addr) + if func is None: + return None + return _function.Function(self, func) def get_functions_at(self, addr:int) -> List['_function.Function']: """ |
