diff options
| author | Rusty Wagner <rusty@vector35.com> | 2015-07-22 16:49:15 -0700 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2015-07-22 16:49:15 -0700 |
| commit | 8901295fceabdd598e6f63e81ba79d6c5e503f4a (patch) | |
| tree | e96263e456b71e57ea137eb27caa103af59c9563 | |
| parent | 290661e66c9983e696bd434f271b033263a0f5c3 (diff) | |
Add support for commenting in disassembly graph
| -rw-r--r-- | binaryninjaapi.h | 4 | ||||
| -rw-r--r-- | function.cpp | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 0883d310..de65ee45 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -952,6 +952,10 @@ namespace BinaryNinja std::vector<Ref<BasicBlock>> GetBasicBlocks() const; void MarkRecentUse(); + std::string GetCommentForAddress(uint64_t addr) const; + std::vector<uint64_t> GetCommentedAddresses() const; + void SetCommentForAddress(uint64_t addr, const std::string& comment); + Ref<LowLevelILFunction> GetLowLevelIL() const; std::vector<Ref<BasicBlock>> GetLowLevelILBasicBlocks() const; diff --git a/function.cpp b/function.cpp index 6e0a221d..45b29752 100644 --- a/function.cpp +++ b/function.cpp @@ -53,6 +53,32 @@ void Function::MarkRecentUse() } +string Function::GetCommentForAddress(uint64_t addr) const +{ + char* comment = BNGetCommentForAddress(m_func, addr); + string result = comment; + BNFreeString(comment); + return result; +} + + +vector<uint64_t> Function::GetCommentedAddresses() const +{ + size_t count; + uint64_t* addrs = BNGetCommentedAddresses(m_func, &count); + vector<uint64_t> result; + result.insert(result.end(), addrs, &addrs[count]); + BNFreeAddressList(addrs); + return result; +} + + +void Function::SetCommentForAddress(uint64_t addr, const string& comment) +{ + BNSetCommentForAddress(m_func, addr, comment.c_str()); +} + + Ref<LowLevelILFunction> Function::GetLowLevelIL() const { return new LowLevelILFunction(BNGetFunctionLowLevelIL(m_func)); |
