summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2019-07-30 18:21:15 -0400
committerRusty Wagner <rusty@vector35.com>2020-04-17 14:20:36 -0400
commit652dd72149b9c030e438d6de1a03ef54eafd8091 (patch)
tree17e798a8becf6c39d236f31111c136f13b4f49a3
parent203717232e816d42973f05f1c9fbc950914d71dc (diff)
Add continue HLIL instruction
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--highlevelilinstruction.cpp9
-rw-r--r--highlevelilinstruction.h1
-rw-r--r--python/highlevelil.py1
5 files changed, 13 insertions, 0 deletions
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<ExprId>& 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<BNHighLevelILOperation, vector<HighLevelILOperandUsage>>
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<HLIL_CASE>()), *this);
case HLIL_BREAK:
return dest->Break(*this);
+ case HLIL_CONTINUE:
+ return dest->Continue(*this);
case HLIL_ASSIGN:
return dest->Assign(size, subExprHandler(GetDestExpr<HLIL_ASSIGN>()),
subExprHandler(GetSourceExpr<HLIL_ASSIGN>()), *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<HLIL_NOP>: public HighLevelILInstructionBase {};
template <> struct HighLevelILInstructionAccessor<HLIL_BREAK>: public HighLevelILInstructionBase {};
+ template <> struct HighLevelILInstructionAccessor<HLIL_CONTINUE>: public HighLevelILInstructionBase {};
template <> struct HighLevelILInstructionAccessor<HLIL_NORET>: public HighLevelILInstructionBase {};
template <> struct HighLevelILInstructionAccessor<HLIL_BP>: public HighLevelILInstructionBase {};
template <> struct HighLevelILInstructionAccessor<HLIL_UNDEF>: 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: [],