From 0c3c4285a38d70bafb089b85e6764d0f4153ff9c Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Wed, 25 May 2016 19:29:10 -0400 Subject: Adding API to retrieve basic block annotations --- function.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'function.cpp') diff --git a/function.cpp b/function.cpp index 7cc30351..70cbfe2a 100644 --- a/function.cpp +++ b/function.cpp @@ -458,3 +458,28 @@ vector Function::GetIndirectBranchesAt(Architecture* arch, u BNFreeIndirectBranchList(branches); return result; } + + +vector> Function::GetBlockAnnotations(Architecture* arch, uint64_t addr) +{ + size_t count; + BNInstructionTextLine* lines = BNGetFunctionBlockAnnotations(m_object, arch->GetObject(), addr, &count); + + vector> result; + for (size_t i = 0; i < count; i++) + { + vector line; + for (size_t j = 0; j < lines[i].count; j++) + { + InstructionTextToken token; + token.type = lines[i].tokens[j].type; + token.text = lines[i].tokens[j].text; + token.value = lines[i].tokens[j].value; + line.push_back(token); + } + result.push_back(line); + } + + BNFreeInstructionTextLines(lines, count); + return result; +} -- cgit v1.3.1