From 620dd96217a49803fe04c6bc286291ddd857dcba Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Sat, 3 Aug 2019 22:40:57 -0400 Subject: Expand support for HLIL switch/case and data flow access --- highlevelilinstruction.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'highlevelilinstruction.h') diff --git a/highlevelilinstruction.h b/highlevelilinstruction.h index 9dc6a604..6c249d94 100644 --- a/highlevelilinstruction.h +++ b/highlevelilinstruction.h @@ -94,6 +94,7 @@ namespace BinaryNinja DestExprsHighLevelOperandUsage, BlockExprsHighLevelOperandUsage, CasesHighLevelOperandUsage, + ValueExprsHighLevelOperandUsage, SourceSSAVariablesHighLevelOperandUsage, SourceMemoryVersionHighLevelOperandUsage, SourceMemoryVersionsHighLevelOperandUsage, @@ -293,6 +294,11 @@ namespace BinaryNinja void UpdateRawOperandAsExprList(size_t operandIndex, const std::vector& exprs); void UpdateRawOperandAsExprList(size_t operandIndex, const std::vector& exprs); + RegisterValue GetValue() const; + PossibleValueSet GetPossibleValues(const std::set& options = + std::set()) const; + Confidence> GetType() const; + size_t GetMediumLevelILExprIndex() const; bool HasMediumLevelIL() const; MediumLevelILInstruction GetMediumLevelIL() const; @@ -360,6 +366,10 @@ namespace BinaryNinja ExprId CopyTo(HighLevelILFunction* dest, const std::function& subExprHandler) const; + bool operator<(const HighLevelILInstruction& other) const; + bool operator==(const HighLevelILInstruction& other) const; + bool operator!=(const HighLevelILInstruction& other) const; + // Templated accessors for instruction operands, use these for efficient access to a known instruction template HighLevelILInstruction GetSourceExpr() const { return As().GetSourceExpr(); } template Variable GetVariable() const { return As().GetVariable(); } @@ -389,6 +399,7 @@ namespace BinaryNinja template HighLevelILInstructionList GetDestExprs() const { return As().GetDestExprs(); } template HighLevelILInstructionList GetBlockExprs() const { return As().GetBlockExprs(); } template HighLevelILInstructionList GetCases() const { return As().GetCases(); } + template HighLevelILInstructionList GetValueExprs() const { return As().GetValueExprs(); } template HighLevelILSSAVariableList GetSourceSSAVariables() const { return As().GetSourceSSAVariables(); } template size_t GetSourceMemoryVersion() const { return As().GetSourceMemoryVersion(); } template HighLevelILIndexList GetSourceMemoryVersions() const { return As().GetSourceMemoryVersions(); } @@ -441,6 +452,7 @@ namespace BinaryNinja HighLevelILInstructionList GetDestExprs() const; HighLevelILInstructionList GetBlockExprs() const; HighLevelILInstructionList GetCases() const; + HighLevelILInstructionList GetValueExprs() const; HighLevelILSSAVariableList GetSourceSSAVariables() const; size_t GetSourceMemoryVersion() const; HighLevelILIndexList GetSourceMemoryVersions() const; @@ -565,8 +577,8 @@ namespace BinaryNinja }; template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase { - HighLevelILInstruction GetConditionExpr() const { return GetRawOperandAsExpr(0); } - HighLevelILInstruction GetTrueExpr() const { return GetRawOperandAsExpr(1); } + HighLevelILInstructionList GetValueExprs() const { return GetRawOperandAsExprList(0); } + HighLevelILInstruction GetTrueExpr() const { return GetRawOperandAsExpr(2); } }; template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase { -- cgit v1.3.1