summaryrefslogtreecommitdiff
path: root/function.cpp
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2026-06-02 09:00:15 -0400
committerBrandon Miller <brandon@vector35.com>2026-06-02 09:00:15 -0400
commit5953d087a9a104e7abb63c5739091214edf2faca (patch)
treeabd95a2698f32b8e1f6ae7feaa9647cff8d218ae /function.cpp
parent68215ea14cfbaa4966f830d85d98f7f49b416455 (diff)
Add support for multiple global pointer registers
Diffstat (limited to 'function.cpp')
-rw-r--r--function.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/function.cpp b/function.cpp
index bd7003e0..d81394f8 100644
--- a/function.cpp
+++ b/function.cpp
@@ -2428,8 +2428,24 @@ Ref<Tag> Function::CreateUserFunctionTag(Ref<TagType> tagType, const std::string
Confidence<RegisterValue> Function::GetGlobalPointerValue() const
{
- BNRegisterValueWithConfidence value = BNGetFunctionGlobalPointerValue(m_object);
- return Confidence<RegisterValue>(RegisterValue::FromAPIObject(value.value), value.confidence);
+ auto values = GetGlobalPointerValues();
+ if (values.empty())
+ return Confidence<RegisterValue>();
+ return values[0].second;
+}
+
+
+vector<pair<uint32_t, Confidence<RegisterValue>>> Function::GetGlobalPointerValues() const
+{
+ size_t count;
+ BNRegisterValueWithConfidenceAndRegister* values = BNGetFunctionGlobalPointerValues(m_object, &count);
+ vector<pair<uint32_t, Confidence<RegisterValue>>> result;
+ result.reserve(count);
+ for (size_t i = 0; i < count; i++)
+ result.emplace_back(values[i].reg,
+ Confidence<RegisterValue>(RegisterValue::FromAPIObject(values[i].value.value), values[i].value.confidence));
+ BNFreeRegisterValueWithConfidenceAndRegisterList(values);
+ return result;
}