From 652dd72149b9c030e438d6de1a03ef54eafd8091 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 30 Jul 2019 18:21:15 -0400 Subject: Add continue HLIL instruction --- binaryninjaapi.h | 1 + binaryninjacore.h | 1 + highlevelilinstruction.cpp | 9 +++++++++ highlevelilinstruction.h | 1 + python/highlevelil.py | 1 + 5 files changed, 13 insertions(+) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index ed10caca..1cbcc973 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -4059,6 +4059,7 @@ __attribute__ ((format (printf, 1, 2))) const ILSourceLocation& loc = ILSourceLocation()); ExprId Case(ExprId condition, ExprId expr, const ILSourceLocation& loc = ILSourceLocation()); ExprId Break(const ILSourceLocation& loc = ILSourceLocation()); + ExprId Continue(const ILSourceLocation& loc = ILSourceLocation()); ExprId Jump(ExprId dest, const ILSourceLocation& loc = ILSourceLocation()); ExprId Return(const std::vector& sources, const ILSourceLocation& loc = ILSourceLocation()); ExprId NoReturn(const ILSourceLocation& loc = ILSourceLocation()); diff --git a/binaryninjacore.h b/binaryninjacore.h index 5487baab..03ddcd4d 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -1058,6 +1058,7 @@ extern "C" HLIL_SWITCH, HLIL_CASE, HLIL_BREAK, + HLIL_CONTINUE, HLIL_JUMP, HLIL_RET, HLIL_NORET, diff --git a/highlevelilinstruction.cpp b/highlevelilinstruction.cpp index 311d4e93..a53d5fe4 100644 --- a/highlevelilinstruction.cpp +++ b/highlevelilinstruction.cpp @@ -71,6 +71,7 @@ unordered_map> HighLevelILInstructionBase::operationOperandUsage = { {HLIL_NOP, {}}, {HLIL_BREAK, {}}, + {HLIL_CONTINUE, {}}, {HLIL_NORET, {}}, {HLIL_BP, {}}, {HLIL_UNDEF, {}}, @@ -974,6 +975,8 @@ ExprId HighLevelILInstruction::CopyTo(HighLevelILFunction* dest, subExprHandler(GetTrueExpr()), *this); case HLIL_BREAK: return dest->Break(*this); + case HLIL_CONTINUE: + return dest->Continue(*this); case HLIL_ASSIGN: return dest->Assign(size, subExprHandler(GetDestExpr()), subExprHandler(GetSourceExpr()), *this); @@ -1457,6 +1460,12 @@ ExprId HighLevelILFunction::Break(const ILSourceLocation& loc) } +ExprId HighLevelILFunction::Continue(const ILSourceLocation& loc) +{ + return AddExprWithLocation(HLIL_CONTINUE, loc, 0); +} + + ExprId HighLevelILFunction::Jump(ExprId dest, const ILSourceLocation& loc) { return AddExprWithLocation(HLIL_JUMP, loc, 0, dest); diff --git a/highlevelilinstruction.h b/highlevelilinstruction.h index 2ec67fd3..faf287cc 100644 --- a/highlevelilinstruction.h +++ b/highlevelilinstruction.h @@ -630,6 +630,7 @@ namespace BinaryNinja template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase {}; template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase {}; + template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase {}; template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase {}; template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase {}; template <> struct HighLevelILInstructionAccessor: public HighLevelILInstructionBase {}; diff --git a/python/highlevelil.py b/python/highlevelil.py index d657ddc4..46fbe972 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -87,6 +87,7 @@ class HighLevelILInstruction(object): HighLevelILOperation.HLIL_SWITCH: [("condition", "expr"), ("default", "expr"), ("cases", "expr_list")], HighLevelILOperation.HLIL_CASE: [("condition", "expr"), ("body", "expr")], HighLevelILOperation.HLIL_BREAK: [], + HighLevelILOperation.HLIL_CONTINUE: [], HighLevelILOperation.HLIL_JUMP: [("dest", "expr")], HighLevelILOperation.HLIL_RET: [("src", "expr_list")], HighLevelILOperation.HLIL_NORET: [], -- cgit v1.3.1