diff options
| author | rollsafe <rollsafe@users.noreply.github.com> | 2019-07-30 21:48:38 -0400 |
|---|---|---|
| committer | rollsafe <rollsafe@users.noreply.github.com> | 2019-07-31 20:29:46 -0400 |
| commit | 9bb1a15b800da0ac5b60c40e3b10321e4efc5a1b (patch) | |
| tree | 9f24e377b1e2db29b0ce8aff5ec4b217010789db /function.cpp | |
| parent | a8e440c27cf81b91d040a6b3ac495b8dfb9ada8e (diff) | |
Cache function callee addresses and create an API to access them
Diffstat (limited to 'function.cpp')
| -rw-r--r-- | function.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/function.cpp b/function.cpp index 66fd870c..752d0bd1 100644 --- a/function.cpp +++ b/function.cpp @@ -246,6 +246,27 @@ void Function::SetCommentForAddress(uint64_t addr, const string& comment) } +vector<ReferenceSource> Function::GetCallSites() const +{ + size_t count; + BNReferenceSource* refs = BNGetFunctionCallSites(m_object, &count); + + vector<ReferenceSource> result; + result.reserve(count); + for (size_t i = 0; i < count; i++) + { + ReferenceSource src; + src.func = new Function(BNNewFunctionReference(refs[i].func)); + src.arch = new CoreArchitecture(refs[i].arch); + src.addr = refs[i].addr; + result.push_back(src); + } + + BNFreeCodeReferences(refs, count); + return result; +} + + void Function::AddUserCodeReference(Architecture* fromArch, uint64_t fromAddr, uint64_t toAddr) { BNAddUserCodeReference(m_object, fromArch->GetObject(), fromAddr, toAddr); |
