summaryrefslogtreecommitdiff
path: root/function.cpp
diff options
context:
space:
mode:
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;
}