diff options
| author | Rusty Wagner <rusty@vector35.com> | 2017-08-01 23:39:18 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2017-08-05 20:49:14 -0400 |
| commit | e47e2fb13369ff7d1c9e7728bb793ee56640afe1 (patch) | |
| tree | b6683fa3e28da3158c6559612959267a81fabbb2 /lowlevelil.cpp | |
| parent | 92ef6481d84d3289ba86a9b9ffe6553bb5842c5d (diff) | |
Refactor IL instruction access APIs
Diffstat (limited to 'lowlevelil.cpp')
| -rw-r--r-- | lowlevelil.cpp | 563 |
1 files changed, 158 insertions, 405 deletions
diff --git a/lowlevelil.cpp b/lowlevelil.cpp index 0cb733ac..690f0b41 100644 --- a/lowlevelil.cpp +++ b/lowlevelil.cpp @@ -19,6 +19,7 @@ // IN THE SOFTWARE. #include "binaryninjaapi.h" +#include "lowlevelilinstruction.h" using namespace BinaryNinja; using namespace std; @@ -42,460 +43,124 @@ LowLevelILFunction::LowLevelILFunction(BNLowLevelILFunction* func) } -uint64_t LowLevelILFunction::GetCurrentAddress() const -{ - return BNLowLevelILGetCurrentAddress(m_object); -} - - -void LowLevelILFunction::SetCurrentAddress(Architecture* arch, uint64_t addr) -{ - BNLowLevelILSetCurrentAddress(m_object, arch ? arch->GetObject() : nullptr, addr); -} - - -size_t LowLevelILFunction::GetInstructionStart(Architecture* arch, uint64_t addr) -{ - return BNLowLevelILGetInstructionStart(m_object, arch ? arch->GetObject() : nullptr, addr); -} - - -void LowLevelILFunction::ClearIndirectBranches() -{ - BNLowLevelILClearIndirectBranches(m_object); -} - - -void LowLevelILFunction::SetIndirectBranches(const vector<ArchAndAddr>& branches) -{ - BNArchitectureAndAddress* branchList = new BNArchitectureAndAddress[branches.size()]; - for (size_t i = 0; i < branches.size(); i++) - { - branchList[i].arch = branches[i].arch->GetObject(); - branchList[i].address = branches[i].address; - } - BNLowLevelILSetIndirectBranches(m_object, branchList, branches.size()); - delete[] branchList; -} - - -ExprId LowLevelILFunction::AddExpr(BNLowLevelILOperation operation, size_t size, uint32_t flags, - ExprId a, ExprId b, ExprId c, ExprId d) -{ - return BNLowLevelILAddExpr(m_object, operation, size, flags, a, b, c, d); -} - - -ExprId LowLevelILFunction::AddInstruction(size_t expr) -{ - return BNLowLevelILAddInstruction(m_object, expr); -} - - -ExprId LowLevelILFunction::Nop() -{ - return AddExpr(LLIL_NOP, 0, 0); -} - - -ExprId LowLevelILFunction::SetRegister(size_t size, uint32_t reg, ExprId val, uint32_t flags) -{ - return AddExpr(LLIL_SET_REG, size, flags, reg, val); -} - - -ExprId LowLevelILFunction::SetRegisterSplit(size_t size, uint32_t high, uint32_t low, ExprId val) -{ - return AddExpr(LLIL_SET_REG_SPLIT, size, 0, high, low, val); -} - - -ExprId LowLevelILFunction::SetFlag(uint32_t flag, ExprId val) -{ - return AddExpr(LLIL_SET_FLAG, 0, 0, flag, val); -} - - -ExprId LowLevelILFunction::Load(size_t size, ExprId addr) -{ - return AddExpr(LLIL_LOAD, size, 0, addr); -} - - -ExprId LowLevelILFunction::Store(size_t size, ExprId addr, ExprId val) -{ - return AddExpr(LLIL_STORE, size, 0, addr, val); -} - - -ExprId LowLevelILFunction::Push(size_t size, ExprId val) -{ - return AddExpr(LLIL_PUSH, size, 0, val); -} - - -ExprId LowLevelILFunction::Pop(size_t size) -{ - return AddExpr(LLIL_POP, size, 0); -} - - -ExprId LowLevelILFunction::Register(size_t size, uint32_t reg) -{ - return AddExpr(LLIL_REG, size, 0, reg); -} - - -ExprId LowLevelILFunction::Const(size_t size, uint64_t val) -{ - return AddExpr(LLIL_CONST, size, 0, val); -} - - -ExprId LowLevelILFunction::ConstPointer(size_t size, uint64_t val) -{ - return AddExpr(LLIL_CONST_PTR, size, 0, val); -} - - -ExprId LowLevelILFunction::Flag(uint32_t reg) -{ - return AddExpr(LLIL_FLAG, 0, 0, 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); -} - - -ExprId LowLevelILFunction::AddCarry(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags) -{ - return AddExpr(LLIL_ADC, size, flags, a, b, carry); -} - - -ExprId LowLevelILFunction::Sub(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_SUB, size, flags, a, b); -} - - -ExprId LowLevelILFunction::SubBorrow(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags) -{ - return AddExpr(LLIL_SBB, size, flags, a, b, carry); -} - - -ExprId LowLevelILFunction::And(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_AND, size, flags, a, b); -} - - -ExprId LowLevelILFunction::Or(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_OR, size, flags, a, b); -} - - -ExprId LowLevelILFunction::Xor(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_XOR, size, flags, a, b); -} - - -ExprId LowLevelILFunction::ShiftLeft(size_t size, ExprId a, ExprId b, uint32_t flags) +Ref<Function> LowLevelILFunction::GetFunction() const { - return AddExpr(LLIL_LSL, size, flags, a, b); -} - - -ExprId LowLevelILFunction::LogicalShiftRight(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_LSR, size, flags, a, b); -} - - -ExprId LowLevelILFunction::ArithShiftRight(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_ASR, size, flags, a, b); -} - - -ExprId LowLevelILFunction::RotateLeft(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_ROL, size, flags, a, b); -} - - -ExprId LowLevelILFunction::RotateLeftCarry(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags) -{ - return AddExpr(LLIL_RLC, size, flags, a, b, carry); -} - - -ExprId LowLevelILFunction::RotateRight(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_ROR, size, flags, a, b); -} - - -ExprId LowLevelILFunction::RotateRightCarry(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags) -{ - return AddExpr(LLIL_RRC, size, flags, a, b, carry); -} - - -ExprId LowLevelILFunction::Mult(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_MUL, size, flags, a, b); -} - - -ExprId LowLevelILFunction::MultDoublePrecUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_MULU_DP, size, flags, a, b); -} - - -ExprId LowLevelILFunction::MultDoublePrecSigned(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_MULS_DP, size, flags, a, b); -} - - -ExprId LowLevelILFunction::DivUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_DIVU, size, flags, a, b); -} - - -ExprId LowLevelILFunction::DivDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags) -{ - return AddExpr(LLIL_DIVU_DP, size, flags, high, low, div); -} - - -ExprId LowLevelILFunction::DivSigned(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_DIVS, size, flags, a, b); -} - - -ExprId LowLevelILFunction::DivDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags) -{ - return AddExpr(LLIL_DIVS_DP, size, flags, high, low, div); -} - - -ExprId LowLevelILFunction::ModUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_MODU, size, flags, a, b); -} - - -ExprId LowLevelILFunction::ModDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags) -{ - return AddExpr(LLIL_MODU_DP, size, flags, high, low, div); -} - - -ExprId LowLevelILFunction::ModSigned(size_t size, ExprId a, ExprId b, uint32_t flags) -{ - return AddExpr(LLIL_MODS, size, flags, a, b); -} - - -ExprId LowLevelILFunction::ModDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags) -{ - return AddExpr(LLIL_MODS_DP, size, flags, high, low, div); -} - - -ExprId LowLevelILFunction::Neg(size_t size, ExprId a, uint32_t flags) -{ - return AddExpr(LLIL_NEG, size, flags, a); -} - - -ExprId LowLevelILFunction::Not(size_t size, ExprId a, uint32_t flags) -{ - return AddExpr(LLIL_NOT, size, flags, a); -} - - -ExprId LowLevelILFunction::SignExtend(size_t size, ExprId a, uint32_t flags) -{ - return AddExpr(LLIL_SX, size, flags, a); -} - - -ExprId LowLevelILFunction::ZeroExtend(size_t size, ExprId a, uint32_t flags) -{ - return AddExpr(LLIL_ZX, size, flags, a); -} - - -ExprId LowLevelILFunction::LowPart(size_t size, ExprId a, uint32_t flags) -{ - return AddExpr(LLIL_LOW_PART, size, flags, a); -} - - -ExprId LowLevelILFunction::Jump(ExprId dest) -{ - return AddExpr(LLIL_JUMP, 0, 0, dest); -} - - -ExprId LowLevelILFunction::Call(ExprId dest) -{ - return AddExpr(LLIL_CALL, 0, 0, dest); -} - - -ExprId LowLevelILFunction::Return(size_t dest) -{ - return AddExpr(LLIL_RET, 0, 0, dest); -} - - -ExprId LowLevelILFunction::NoReturn() -{ - return AddExpr(LLIL_NORET, 0, 0); -} - - -ExprId LowLevelILFunction::FlagCondition(BNLowLevelILFlagCondition cond) -{ - return AddExpr(LLIL_FLAG_COND, 0, 0, (ExprId)cond); -} - - -ExprId LowLevelILFunction::CompareEqual(size_t size, ExprId a, ExprId b) -{ - return AddExpr(LLIL_CMP_E, size, 0, a, b); -} - - -ExprId LowLevelILFunction::CompareNotEqual(size_t size, ExprId a, ExprId b) -{ - return AddExpr(LLIL_CMP_NE, size, 0, a, b); -} - - -ExprId LowLevelILFunction::CompareSignedLessThan(size_t size, ExprId a, ExprId b) -{ - return AddExpr(LLIL_CMP_SLT, size, 0, a, b); -} - - -ExprId LowLevelILFunction::CompareUnsignedLessThan(size_t size, ExprId a, ExprId b) -{ - return AddExpr(LLIL_CMP_ULT, size, 0, a, b); -} - - -ExprId LowLevelILFunction::CompareSignedLessEqual(size_t size, ExprId a, ExprId b) -{ - return AddExpr(LLIL_CMP_SLE, size, 0, a, b); + BNFunction* func = BNGetLowLevelILOwnerFunction(m_object); + if (!func) + return nullptr; + return new Function(func); } -ExprId LowLevelILFunction::CompareUnsignedLessEqual(size_t size, ExprId a, ExprId b) +Ref<Architecture> LowLevelILFunction::GetArchitecture() const { - return AddExpr(LLIL_CMP_ULE, size, 0, a, b); + Ref<Function> func = GetFunction(); + if (!func) + return nullptr; + return func->GetArchitecture(); } -ExprId LowLevelILFunction::CompareSignedGreaterEqual(size_t size, ExprId a, ExprId b) +void LowLevelILFunction::PrepareToCopyFunction(LowLevelILFunction* func) { - return AddExpr(LLIL_CMP_SGE, size, 0, a, b); + BNPrepareToCopyLowLevelILFunction(m_object, func->GetObject()); } -ExprId LowLevelILFunction::CompareUnsignedGreaterEqual(size_t size, ExprId a, ExprId b) +void LowLevelILFunction::PrepareToCopyBlock(BasicBlock* block) { - return AddExpr(LLIL_CMP_UGE, size, 0, a, b); + BNPrepareToCopyLowLevelILBasicBlock(m_object, block->GetObject()); } -ExprId LowLevelILFunction::CompareSignedGreaterThan(size_t size, ExprId a, ExprId b) +BNLowLevelILLabel* LowLevelILFunction::GetLabelForSourceInstruction(size_t i) { - return AddExpr(LLIL_CMP_SGT, size, 0, a, b); + return BNGetLabelForLowLevelILSourceInstruction(m_object, i); } -ExprId LowLevelILFunction::CompareUnsignedGreaterThan(size_t size, ExprId a, ExprId b) +uint64_t LowLevelILFunction::GetCurrentAddress() const { - return AddExpr(LLIL_CMP_UGT, size, 0, a, b); + return BNLowLevelILGetCurrentAddress(m_object); } -ExprId LowLevelILFunction::TestBit(size_t size, ExprId a, ExprId b) +void LowLevelILFunction::SetCurrentAddress(Architecture* arch, uint64_t addr) { - return AddExpr(LLIL_TEST_BIT, size, 0, a, b); + BNLowLevelILSetCurrentAddress(m_object, arch ? arch->GetObject() : nullptr, addr); } -ExprId LowLevelILFunction::BoolToInt(size_t size, ExprId a) +size_t LowLevelILFunction::GetInstructionStart(Architecture* arch, uint64_t addr) { - return AddExpr(LLIL_BOOL_TO_INT, size, 0, a); + return BNLowLevelILGetInstructionStart(m_object, arch ? arch->GetObject() : nullptr, addr); } -ExprId LowLevelILFunction::SystemCall() +void LowLevelILFunction::ClearIndirectBranches() { - return AddExpr(LLIL_SYSCALL, 0, 0); + BNLowLevelILClearIndirectBranches(m_object); } -ExprId LowLevelILFunction::Breakpoint() +void LowLevelILFunction::SetIndirectBranches(const vector<ArchAndAddr>& branches) { - return AddExpr(LLIL_BP, 0, 0); + BNArchitectureAndAddress* branchList = new BNArchitectureAndAddress[branches.size()]; + for (size_t i = 0; i < branches.size(); i++) + { + branchList[i].arch = branches[i].arch->GetObject(); + branchList[i].address = branches[i].address; + } + BNLowLevelILSetIndirectBranches(m_object, branchList, branches.size()); + delete[] branchList; } -ExprId LowLevelILFunction::Trap(uint32_t num) +ExprId LowLevelILFunction::AddExpr(BNLowLevelILOperation operation, size_t size, uint32_t flags, + ExprId a, ExprId b, ExprId c, ExprId d) { - return AddExpr(LLIL_TRAP, 0, 0, num); + return BNLowLevelILAddExpr(m_object, operation, size, flags, a, b, c, d); } -ExprId LowLevelILFunction::Undefined() +ExprId LowLevelILFunction::AddExprWithLocation(BNLowLevelILOperation operation, uint64_t addr, + uint32_t sourceOperand, size_t size, uint32_t flags, ExprId a, ExprId b, ExprId c, ExprId d) { - return AddExpr(LLIL_UNDEF, 0, 0); + return BNLowLevelILAddExprWithLocation(m_object, addr, sourceOperand, operation, size, flags, a, b, c, d); } -ExprId LowLevelILFunction::Unimplemented() +ExprId LowLevelILFunction::AddExprWithLocation(BNLowLevelILOperation operation, const ILSourceLocation& loc, + size_t size, uint32_t flags, ExprId a, ExprId b, ExprId c, ExprId d) { - return AddExpr(LLIL_UNIMPL, 0, 0); + if (loc.valid) + { + return BNLowLevelILAddExprWithLocation(m_object, loc.address, loc.sourceOperand, operation, + size, flags, a, b, c, d); + } + return BNLowLevelILAddExpr(m_object, operation, size, flags, a, b, c, d); } -ExprId LowLevelILFunction::UnimplementedMemoryRef(size_t size, ExprId addr) +ExprId LowLevelILFunction::AddInstruction(size_t expr) { - return AddExpr(LLIL_UNIMPL_MEM, size, 0, addr); + return BNLowLevelILAddInstruction(m_object, expr); } -ExprId LowLevelILFunction::Goto(BNLowLevelILLabel& label) +ExprId LowLevelILFunction::Goto(BNLowLevelILLabel& label, const ILSourceLocation& loc) { + if (loc.valid) + return BNLowLevelILGotoWithLocation(m_object, &label, loc.address, loc.sourceOperand); return BNLowLevelILGoto(m_object, &label); } -ExprId LowLevelILFunction::If(ExprId operand, BNLowLevelILLabel& t, BNLowLevelILLabel& f) +ExprId LowLevelILFunction::If(ExprId operand, BNLowLevelILLabel& t, BNLowLevelILLabel& f, + const ILSourceLocation& loc) { + if (loc.valid) + return BNLowLevelILIfWithLocation(m_object, operand, &t, &f, loc.address, loc.sourceOperand); return BNLowLevelILIf(m_object, operand, &t, &f); } @@ -540,6 +205,45 @@ ExprId LowLevelILFunction::AddOperandList(const vector<ExprId> operands) } +ExprId LowLevelILFunction::AddIndexList(const vector<size_t> operands) +{ + uint64_t* operandList = new uint64_t[operands.size()]; + for (size_t i = 0; i < operands.size(); i++) + operandList[i] = operands[i]; + ExprId result = (ExprId)BNLowLevelILAddOperandList(m_object, operandList, operands.size()); + delete[] operandList; + return result; +} + + +ExprId LowLevelILFunction::AddSSARegisterList(const vector<SSARegister>& regs) +{ + uint64_t* operandList = new uint64_t[regs.size() * 2]; + for (size_t i = 0; i < regs.size(); i++) + { + operandList[i * 2] = regs[i].reg; + operandList[(i * 2) + 1] = regs[i].version; + } + ExprId result = (ExprId)BNLowLevelILAddOperandList(m_object, operandList, regs.size() * 2); + delete[] operandList; + return result; +} + + +ExprId LowLevelILFunction::AddSSAFlagList(const vector<SSAFlag>& flags) +{ + uint64_t* operandList = new uint64_t[flags.size() * 2]; + for (size_t i = 0; i < flags.size(); i++) + { + operandList[i * 2] = flags[i].flag; + operandList[(i * 2) + 1] = flags[i].version; + } + ExprId result = (ExprId)BNLowLevelILAddOperandList(m_object, operandList, flags.size() * 2); + delete[] operandList; + return result; +} + + ExprId LowLevelILFunction::GetExprForRegisterOrConstant(const BNRegisterOrConstant& operand, size_t size) { if (operand.constant) @@ -599,18 +303,43 @@ ExprId LowLevelILFunction::Operand(uint32_t n, ExprId expr) } -BNLowLevelILInstruction LowLevelILFunction::operator[](size_t i) const +BNLowLevelILInstruction LowLevelILFunction::GetRawExpr(size_t i) const { return BNGetLowLevelILByIndex(m_object, i); } +LowLevelILInstruction LowLevelILFunction::operator[](size_t i) +{ + return GetInstruction(i); +} + + +LowLevelILInstruction LowLevelILFunction::GetInstruction(size_t i) +{ + size_t expr = GetIndexForInstruction(i); + return LowLevelILInstruction(this, GetRawExpr(expr), expr, i); +} + + +LowLevelILInstruction LowLevelILFunction::GetExpr(size_t i) +{ + return LowLevelILInstruction(this, GetRawExpr(i), i, GetInstructionForExpr(i)); +} + + size_t LowLevelILFunction::GetIndexForInstruction(size_t i) const { return BNGetLowLevelILIndexForInstruction(m_object, i); } +size_t LowLevelILFunction::GetInstructionForExpr(size_t expr) const +{ + return BNGetLowLevelILInstructionForExpr(m_object, expr); +} + + size_t LowLevelILFunction::GetInstructionCount() const { return BNGetLowLevelILInstructionCount(m_object); @@ -623,6 +352,18 @@ size_t LowLevelILFunction::GetExprCount() const } +void LowLevelILFunction::UpdateInstructionOperand(size_t i, size_t operandIndex, ExprId value) +{ + BNUpdateLowLevelILOperand(m_object, i, operandIndex, value); +} + + +void LowLevelILFunction::ReplaceExpr(size_t expr, size_t newExpr) +{ + BNReplaceLowLevelILExpr(m_object, expr, newExpr); +} + + void LowLevelILFunction::AddLabelForAddress(Architecture* arch, ExprId addr) { BNAddLowLevelILLabelForAddress(m_object, arch->GetObject(), addr); @@ -765,15 +506,15 @@ size_t LowLevelILFunction::GetNonSSAExprIndex(size_t expr) const } -size_t LowLevelILFunction::GetSSARegisterDefinition(uint32_t reg, size_t version) const +size_t LowLevelILFunction::GetSSARegisterDefinition(const SSARegister& reg) const { - return BNGetLowLevelILSSARegisterDefinition(m_object, reg, version); + return BNGetLowLevelILSSARegisterDefinition(m_object, reg.reg, reg.version); } -size_t LowLevelILFunction::GetSSAFlagDefinition(uint32_t flag, size_t version) const +size_t LowLevelILFunction::GetSSAFlagDefinition(const SSAFlag& flag) const { - return BNGetLowLevelILSSAFlagDefinition(m_object, flag, version); + return BNGetLowLevelILSSAFlagDefinition(m_object, flag.flag, flag.version); } @@ -783,10 +524,10 @@ size_t LowLevelILFunction::GetSSAMemoryDefinition(size_t version) const } -set<size_t> LowLevelILFunction::GetSSARegisterUses(uint32_t reg, size_t version) const +set<size_t> LowLevelILFunction::GetSSARegisterUses(const SSARegister& reg) const { size_t count; - size_t* instrs = BNGetLowLevelILSSARegisterUses(m_object, reg, version, &count); + size_t* instrs = BNGetLowLevelILSSARegisterUses(m_object, reg.reg, reg.version, &count); set<size_t> result; for (size_t i = 0; i < count; i++) @@ -797,10 +538,10 @@ set<size_t> LowLevelILFunction::GetSSARegisterUses(uint32_t reg, size_t version) } -set<size_t> LowLevelILFunction::GetSSAFlagUses(uint32_t flag, size_t version) const +set<size_t> LowLevelILFunction::GetSSAFlagUses(const SSAFlag& flag) const { size_t count; - size_t* instrs = BNGetLowLevelILSSAFlagUses(m_object, flag, version, &count); + size_t* instrs = BNGetLowLevelILSSAFlagUses(m_object, flag.flag, flag.version, &count); set<size_t> result; for (size_t i = 0; i < count; i++) @@ -825,16 +566,16 @@ set<size_t> LowLevelILFunction::GetSSAMemoryUses(size_t version) const } -RegisterValue LowLevelILFunction::GetSSARegisterValue(uint32_t reg, size_t version) +RegisterValue LowLevelILFunction::GetSSARegisterValue(const SSARegister& reg) { - BNRegisterValue value = BNGetLowLevelILSSARegisterValue(m_object, reg, version); + BNRegisterValue value = BNGetLowLevelILSSARegisterValue(m_object, reg.reg, reg.version); return RegisterValue::FromAPIObject(value); } -RegisterValue LowLevelILFunction::GetSSAFlagValue(uint32_t flag, size_t version) +RegisterValue LowLevelILFunction::GetSSAFlagValue(const SSAFlag& flag) { - BNRegisterValue value = BNGetLowLevelILSSAFlagValue(m_object, flag, version); + BNRegisterValue value = BNGetLowLevelILSSAFlagValue(m_object, flag.flag, flag.version); return RegisterValue::FromAPIObject(value); } @@ -846,6 +587,12 @@ RegisterValue LowLevelILFunction::GetExprValue(size_t expr) } +RegisterValue LowLevelILFunction::GetExprValue(const LowLevelILInstruction& expr) +{ + return GetExprValue(expr.exprIndex); +} + + PossibleValueSet LowLevelILFunction::GetPossibleExprValues(size_t expr) { BNPossibleValueSet value = BNGetLowLevelILPossibleExprValues(m_object, expr); @@ -853,6 +600,12 @@ PossibleValueSet LowLevelILFunction::GetPossibleExprValues(size_t expr) } +PossibleValueSet LowLevelILFunction::GetPossibleExprValues(const LowLevelILInstruction& expr) +{ + return GetPossibleExprValues(expr.exprIndex); +} + + RegisterValue LowLevelILFunction::GetRegisterValueAtInstruction(uint32_t reg, size_t instr) { BNRegisterValue value = BNGetLowLevelILRegisterValueAtInstruction(m_object, reg, instr); |
