diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2016-05-08 03:50:36 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2016-05-08 03:52:19 -0400 |
| commit | 45e8803c97b4d11719d1eadf3b6cf56f093ee505 (patch) | |
| tree | 27b027286f8aa96644bb624a24aa66c2929730f3 /lowlevelil.cpp | |
| parent | 9841c8e7610b4fe184a2b33aba2f61bf54123edb (diff) | |
| parent | ecaf78b419d323f6b589aac4b9ff5ff24b314bc6 (diff) | |
merge
Diffstat (limited to 'lowlevelil.cpp')
| -rw-r--r-- | lowlevelil.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lowlevelil.cpp b/lowlevelil.cpp index a006a581..a3d591a0 100644 --- a/lowlevelil.cpp +++ b/lowlevelil.cpp @@ -54,6 +54,25 @@ void LowLevelILFunction::SetCurrentAddress(uint64_t 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) { @@ -463,6 +482,40 @@ void LowLevelILFunction::MarkLabel(BNLowLevelILLabel& label) } +vector<uint64_t> LowLevelILFunction::GetOperandList(ExprId i, size_t listOperand) +{ + size_t count; + uint64_t* operands = BNLowLevelILGetOperandList(m_object, i, listOperand, &count); + vector<uint64_t> result; + for (size_t i = 0; i < count; i++) + result.push_back(operands[i]); + BNLowLevelILFreeOperandList(operands); + return result; +} + + +ExprId LowLevelILFunction::AddLabelList(const vector<BNLowLevelILLabel*>& labels) +{ + BNLowLevelILLabel** labelList = new BNLowLevelILLabel*[labels.size()]; + for (size_t i = 0; i < labels.size(); i++) + labelList[i] = labels[i]; + ExprId result = (ExprId)BNLowLevelILAddLabelList(m_object, labelList, labels.size()); + delete[] labelList; + return result; +} + + +ExprId LowLevelILFunction::AddOperandList(const vector<ExprId> 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::Operand(uint32_t n, ExprId expr) { BNLowLevelILSetExprSourceOperand(m_object, expr, n); |
