summaryrefslogtreecommitdiff
path: root/lowlevelil.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2016-04-24 00:33:26 -0400
committerRusty Wagner <rusty@vector35.com>2016-04-24 00:33:26 -0400
commitc382a4610cc0ea7f8b8134b847d29bca7dc25398 (patch)
tree8dc2347b36c85b431164f435b78305a3c276230c /lowlevelil.cpp
parent12217ad7a1d821c4d232e04da2c9ac4b4e365bf6 (diff)
Create API for adding known indirect branch targets
Diffstat (limited to 'lowlevelil.cpp')
-rw-r--r--lowlevelil.cpp53
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);