summaryrefslogtreecommitdiff
path: root/function.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2022-02-23 21:17:31 -0500
committerRusty Wagner <rusty.wagner@gmail.com>2022-03-11 20:28:57 -0500
commit4cdb1af22efb7374470668919bb19795a64622fd (patch)
tree8a81274089dca4e923e2584500f0858188be1e78 /function.cpp
parente914cfcae37374640b6fa5bf3de70f4dc2b9766d (diff)
Move stack var refs and constant refs behind advanced analysis requests for significant memory savings
Diffstat (limited to 'function.cpp')
-rw-r--r--function.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/function.cpp b/function.cpp
index fd6ea568..712c8155 100644
--- a/function.cpp
+++ b/function.cpp
@@ -570,6 +570,33 @@ vector<StackVariableReference> Function::GetStackVariablesReferencedByInstructio
}
+vector<StackVariableReference> Function::GetStackVariablesReferencedByInstructionIfAvailable(
+ Architecture* arch, uint64_t addr)
+{
+ size_t count;
+ BNStackVariableReference* refs =
+ BNGetStackVariablesReferencedByInstructionIfAvailable(m_object, arch->GetObject(), addr, &count);
+
+ vector<StackVariableReference> result;
+ result.reserve(count);
+ for (size_t i = 0; i < count; i++)
+ {
+ StackVariableReference ref;
+ ref.sourceOperand = refs[i].sourceOperand;
+ ref.type = Confidence<Ref<Type>>(
+ refs[i].type ? new Type(BNNewTypeReference(refs[i].type)) : nullptr, refs[i].typeConfidence);
+ ref.name = refs[i].name;
+ ref.var = Variable::FromIdentifier(refs[i].varIdentifier);
+ ref.referencedOffset = refs[i].referencedOffset;
+ ref.size = refs[i].size;
+ result.push_back(ref);
+ }
+
+ BNFreeStackVariableReferenceList(refs, count);
+ return result;
+}
+
+
vector<BNConstantReference> Function::GetConstantsReferencedByInstruction(Architecture* arch, uint64_t addr)
{
size_t count;
@@ -583,6 +610,20 @@ vector<BNConstantReference> Function::GetConstantsReferencedByInstruction(Archit
}
+vector<BNConstantReference> Function::GetConstantsReferencedByInstructionIfAvailable(Architecture* arch, uint64_t addr)
+{
+ size_t count;
+ BNConstantReference* refs =
+ BNGetConstantsReferencedByInstructionIfAvailable(m_object, arch->GetObject(), addr, &count);
+
+ vector<BNConstantReference> result;
+ result.insert(result.end(), &refs[0], &refs[count]);
+
+ BNFreeConstantReferenceList(refs);
+ return result;
+}
+
+
Ref<LowLevelILFunction> Function::GetLiftedIL() const
{
return new LowLevelILFunction(BNGetFunctionLiftedIL(m_object));