summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
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 /binaryninjaapi.h
parent12217ad7a1d821c4d232e04da2c9ac4b4e365bf6 (diff)
Create API for adding known indirect branch targets
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 8da02369..4ba49cdd 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1272,6 +1272,24 @@ namespace BinaryNinja
int64_t referencedOffset;
};
+ struct IndirectBranchInfo
+ {
+ Ref<Architecture> sourceArch;
+ uint64_t sourceAddr;
+ Ref<Architecture> destArch;
+ uint64_t destAddr;
+ bool autoDefined;
+ };
+
+ struct ArchAndAddr
+ {
+ Ref<Architecture> arch;
+ uint64_t address;
+
+ ArchAndAddr(): arch(nullptr), address(0) {}
+ ArchAndAddr(Architecture* a, uint64_t addr): arch(a), address(addr) {}
+ };
+
class FunctionGraph;
class Function: public CoreRefCountObject<BNFunction, BNNewFunctionReference, BNFreeFunction>
@@ -1318,6 +1336,12 @@ namespace BinaryNinja
void DeleteAutoStackVariable(int64_t offset);
void DeleteUserStackVariable(int64_t offset);
bool GetStackVariableAtFrameOffset(int64_t offset, StackVariable& var);
+
+ void SetAutoIndirectBranches(Architecture* sourceArch, uint64_t source, const std::vector<ArchAndAddr>& branches);
+ void SetUserIndirectBranches(Architecture* sourceArch, uint64_t source, const std::vector<ArchAndAddr>& branches);
+
+ std::vector<IndirectBranchInfo> GetIndirectBranches();
+ std::vector<IndirectBranchInfo> GetIndirectBranchesAt(Architecture* arch, uint64_t addr);
};
struct FunctionGraphTextLine
@@ -1404,6 +1428,9 @@ namespace BinaryNinja
uint64_t GetCurrentAddress() const;
void SetCurrentAddress(uint64_t addr);
+ void ClearIndirectBranches();
+ void SetIndirectBranches(const std::vector<ArchAndAddr>& branches);
+
ExprId AddExpr(BNLowLevelILOperation operation, size_t size, uint32_t flags,
ExprId a = 0, ExprId b = 0, ExprId c = 0, ExprId d = 0);
ExprId AddInstruction(ExprId expr);
@@ -1476,6 +1503,10 @@ namespace BinaryNinja
ExprId If(ExprId operand, BNLowLevelILLabel& t, BNLowLevelILLabel& f);
void MarkLabel(BNLowLevelILLabel& label);
+ std::vector<uint64_t> GetOperandList(ExprId i, size_t listOperand);
+ ExprId AddLabelList(const std::vector<BNLowLevelILLabel*>& labels);
+ ExprId AddOperandList(const std::vector<ExprId> operands);
+
ExprId Operand(uint32_t n, ExprId expr);
BNLowLevelILInstruction operator[](size_t i) const;