summaryrefslogtreecommitdiff
path: root/lowlevelilinstruction.h
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2019-12-19 16:04:11 -0500
committerRusty Wagner <rusty@vector35.com>2019-12-19 16:04:11 -0500
commit741fb0538e0ac6ab14928f78697196803dbd2ed5 (patch)
treedd0b8da88791b03553d659e6672c8d5ba0fdecfa /lowlevelilinstruction.h
parent98771ab9f325e310ae07120cf559f601837380f9 (diff)
LLIL_JUMP_TO/MLIL_JUMP_TO now contain mappings from address to destination instruction
Diffstat (limited to 'lowlevelilinstruction.h')
-rw-r--r--lowlevelilinstruction.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/lowlevelilinstruction.h b/lowlevelilinstruction.h
index af005943..206a51d9 100644
--- a/lowlevelilinstruction.h
+++ b/lowlevelilinstruction.h
@@ -158,6 +158,7 @@ namespace BinaryNinja
SSARegisterStackLowLevelOperand,
SSAFlagLowLevelOperand,
IndexListLowLevelOperand,
+ IndexMapLowLevelOperand,
ExprListLowLevelOperand,
RegisterOrFlagListLowLevelOperand,
SSARegisterListLowLevelOperand,
@@ -218,7 +219,7 @@ namespace BinaryNinja
OutputRegisterOrFlagListLowLevelOperandUsage,
OutputSSARegisterOrFlagListLowLevelOperandUsage,
SourceMemoryVersionsLowLevelOperandUsage,
- TargetListLowLevelOperandUsage,
+ TargetsLowLevelOperandUsage,
RegisterStackAdjustmentsLowLevelOperandUsage,
OffsetLowLevelOperandUsage
};
@@ -385,6 +386,33 @@ namespace BinaryNinja
operator std::vector<size_t>() const;
};
+ class LowLevelILIndexMap
+ {
+ struct ListIterator
+ {
+ LowLevelILIntegerList::const_iterator pos;
+ bool operator==(const ListIterator& a) const { return pos == a.pos; }
+ bool operator!=(const ListIterator& a) const { return pos != a.pos; }
+ bool operator<(const ListIterator& a) const { return pos < a.pos; }
+ ListIterator& operator++() { ++pos; ++pos; return *this; }
+ const std::pair<uint64_t, size_t> operator*();
+ };
+
+ LowLevelILIntegerList m_list;
+
+ public:
+ typedef ListIterator const_iterator;
+
+ LowLevelILIndexMap(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count);
+
+ const_iterator begin() const;
+ const_iterator end() const;
+ size_t size() const;
+ size_t operator[](uint64_t value) const;
+
+ operator std::map<uint64_t, size_t>() const;
+ };
+
class LowLevelILInstructionList
{
struct ListIterator
@@ -577,6 +605,7 @@ namespace BinaryNinja
SSARegisterStack GetRawOperandAsPartialSSARegisterStackSource(size_t operand) const;
SSAFlag GetRawOperandAsSSAFlag(size_t operand) const;
LowLevelILIndexList GetRawOperandAsIndexList(size_t operand) const;
+ LowLevelILIndexMap GetRawOperandAsIndexMap(size_t operand) const;
LowLevelILInstructionList GetRawOperandAsExprList(size_t operand) const;
LowLevelILRegisterOrFlagList GetRawOperandAsRegisterOrFlagList(size_t operand) const;
LowLevelILSSARegisterList GetRawOperandAsSSARegisterList(size_t operand) const;
@@ -731,7 +760,7 @@ namespace BinaryNinja
template <BNLowLevelILOperation N> LowLevelILRegisterOrFlagList GetOutputRegisterOrFlagList() const { return As<N>().GetOutputRegisterOrFlagList(); }
template <BNLowLevelILOperation N> LowLevelILSSARegisterOrFlagList GetOutputSSARegisterOrFlagList() const { return As<N>().GetOutputSSARegisterOrFlagList(); }
template <BNLowLevelILOperation N> LowLevelILIndexList GetSourceMemoryVersions() const { return As<N>().GetSourceMemoryVersions(); }
- template <BNLowLevelILOperation N> LowLevelILIndexList GetTargetList() const { return As<N>().GetTargetList(); }
+ template <BNLowLevelILOperation N> LowLevelILIndexMap GetTargets() const { return As<N>().GetTargets(); }
template <BNLowLevelILOperation N> std::map<uint32_t, int32_t> GetRegisterStackAdjustments() const { return As<N>().GetRegisterStackAdjustments(); }
template <BNLowLevelILOperation N> void SetDestSSAVersion(size_t version) { As<N>().SetDestSSAVersion(version); }
@@ -796,7 +825,7 @@ namespace BinaryNinja
LowLevelILRegisterOrFlagList GetOutputRegisterOrFlagList() const;
LowLevelILSSARegisterOrFlagList GetOutputSSARegisterOrFlagList() const;
LowLevelILIndexList GetSourceMemoryVersions() const;
- LowLevelILIndexList GetTargetList() const;
+ LowLevelILIndexMap GetTargets() const;
std::map<uint32_t, int32_t> GetRegisterStackAdjustments() const;
};
@@ -828,6 +857,7 @@ namespace BinaryNinja
SSARegisterStack GetSSARegisterStack() const;
SSAFlag GetSSAFlag() const;
LowLevelILIndexList GetIndexList() const;
+ LowLevelILIndexMap GetIndexMap() const;
LowLevelILInstructionList GetExprList() const;
LowLevelILSSARegisterList GetSSARegisterList() const;
LowLevelILSSARegisterStackList GetSSARegisterStackList() const;
@@ -1104,7 +1134,7 @@ namespace BinaryNinja
template <> struct LowLevelILInstructionAccessor<LLIL_JUMP_TO>: public LowLevelILInstructionBase
{
LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); }
- LowLevelILIndexList GetTargetList() const { return GetRawOperandAsIndexList(1); }
+ LowLevelILIndexMap GetTargets() const { return GetRawOperandAsIndexMap(1); }
};
template <> struct LowLevelILInstructionAccessor<LLIL_CALL>: public LowLevelILInstructionBase
{