diff options
Diffstat (limited to 'lowlevelil.cpp')
| -rw-r--r-- | lowlevelil.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lowlevelil.cpp b/lowlevelil.cpp index e4c65b3a..7c30df9d 100644 --- a/lowlevelil.cpp +++ b/lowlevelil.cpp @@ -1,6 +1,7 @@ #include "binaryninjaapi.h" using namespace BinaryNinja; +using namespace std; LowLevelILLabel::LowLevelILLabel() @@ -117,6 +118,12 @@ ExprId LowLevelILFunction::Flag(uint32_t reg) } +ExprId LowLevelILFunction::FlagBit(size_t size, uint32_t flag, uint32_t bitIndex) +{ + return AddExpr(LLIL_FLAG_BIT, size, 0, flag, bitIndex); +} + + ExprId LowLevelILFunction::Add(size_t size, ExprId a, ExprId b, uint32_t flags) { return AddExpr(LLIL_ADD, size, flags, a, b); @@ -381,6 +388,12 @@ ExprId LowLevelILFunction::CompareUnsignedGreaterThan(size_t size, ExprId a, Exp } +ExprId LowLevelILFunction::TestBit(size_t size, ExprId a, ExprId b) +{ + return AddExpr(LLIL_TEST_BIT, size, 0, a, b); +} + + ExprId LowLevelILFunction::SystemCall() { return AddExpr(LLIL_SYSCALL, 0, 0); @@ -469,3 +482,47 @@ void LowLevelILFunction::Finalize() { BNFinalizeLowLevelILFunction(m_func); } + + +bool LowLevelILFunction::GetExprText(Architecture* arch, ExprId expr, vector<InstructionTextToken>& tokens) +{ + size_t count; + BNInstructionTextToken* list; + if (!BNGetLowLevelILExprText(m_func, arch->GetArchitectureObject(), expr, &list, &count)) + return false; + + tokens.clear(); + for (size_t i = 0; i < count; i++) + { + InstructionTextToken token; + token.type = list[i].type; + token.text = list[i].text; + token.value = list[i].value; + tokens.push_back(token); + } + + BNFreeInstructionText(list, count); + return true; +} + + +bool LowLevelILFunction::GetInstructionText(Architecture* arch, size_t instr, vector<InstructionTextToken>& tokens) +{ + size_t count; + BNInstructionTextToken* list; + if (!BNGetLowLevelILInstructionText(m_func, arch->GetArchitectureObject(), instr, &list, &count)) + return false; + + tokens.clear(); + for (size_t i = 0; i < count; i++) + { + InstructionTextToken token; + token.type = list[i].type; + token.text = list[i].text; + token.value = list[i].value; + tokens.push_back(token); + } + + BNFreeInstructionText(list, count); + return true; +} |
