diff options
| author | Brandon Miller <brandon@vector35.com> | 2026-06-02 09:00:15 -0400 |
|---|---|---|
| committer | Brandon Miller <brandon@vector35.com> | 2026-06-02 09:00:15 -0400 |
| commit | 5953d087a9a104e7abb63c5739091214edf2faca (patch) | |
| tree | abd95a2698f32b8e1f6ae7feaa9647cff8d218ae /python/function.py | |
| parent | 68215ea14cfbaa4966f830d85d98f7f49b416455 (diff) | |
Add support for multiple global pointer registers
Diffstat (limited to 'python/function.py')
| -rw-r--r-- | python/function.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/python/function.py b/python/function.py index 900aa0de..5e7541f6 100644 --- a/python/function.py +++ b/python/function.py @@ -1605,9 +1605,26 @@ class Function: @property def global_pointer_value(self) -> variable.RegisterValue: - """Discovered value of the global pointer register, if the function uses one (read-only)""" - result = core.BNGetFunctionGlobalPointerValue(self.handle) - return variable.RegisterValue.from_BNRegisterValue(result, self.arch) + """Deprecated. Use :py:attr:`global_pointer_values` instead.""" + values = self.global_pointer_values + if not values: + return variable.Undetermined() + return values[0][1] + + @property + def global_pointer_values(self) -> List[Tuple['architecture.RegisterName', 'variable.RegisterValue']]: + """Discovered values of the global pointer registers, if the function uses any (read-only)""" + count = ctypes.c_ulonglong() + values = core.BNGetFunctionGlobalPointerValues(self.handle, count) + if values is None: + return [] + try: + return [ + (self.arch.get_reg_name(values[i].reg), variable.RegisterValue.from_BNRegisterValue(values[i].value, self.arch)) + for i in range(count.value) + ] + finally: + core.BNFreeRegisterValueWithConfidenceAndRegisterList(values) @property def uses_incoming_global_pointer(self) -> bool: |
