diff options
Diffstat (limited to 'examples/mlil_parser/src/mlil_parser.cpp')
| -rw-r--r-- | examples/mlil_parser/src/mlil_parser.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/examples/mlil_parser/src/mlil_parser.cpp b/examples/mlil_parser/src/mlil_parser.cpp index 0e621ead..a9411251 100644 --- a/examples/mlil_parser/src/mlil_parser.cpp +++ b/examples/mlil_parser/src/mlil_parser.cpp @@ -59,6 +59,7 @@ static void PrintOperation(BNMediumLevelILOperation operation) ENUM_PRINTER(MLIL_ADDRESS_OF_FIELD) ENUM_PRINTER(MLIL_CONST) ENUM_PRINTER(MLIL_CONST_PTR) + ENUM_PRINTER(MLIL_EXTERN_PTR) ENUM_PRINTER(MLIL_ADD) ENUM_PRINTER(MLIL_ADC) ENUM_PRINTER(MLIL_SUB) @@ -322,16 +323,10 @@ int main(int argc, char *argv[]) // Example of using visitors to find all constants in the instruction instr.VisitExprs([&](const MediumLevelILInstruction& expr) { - switch (expr.operation) - { - case MLIL_CONST: - case MLIL_CONST_PTR: + bool status = MediumLevelILFunction::IsConstantType(expr.operation); + if (status) printf(" Found constant 0x%" PRIx64 "\n", expr.GetConstant()); - return false; // Done parsing this - default: - break; - } - return true; // Parse any subexpressions + return !status; }); // Example of using the templated accessors for efficiently parsing load instructions @@ -345,6 +340,12 @@ int main(int argc, char *argv[]) expr.GetSourceExpr<MLIL_LOAD>().GetConstant<MLIL_CONST_PTR>()); return false; // Done parsing this } + else if (expr.GetSourceExpr<MLIL_LOAD>().operation == MLIL_EXTERN_PTR) + { + printf(" Loading from address 0x%" PRIx64 "\n", + expr.GetSourceExpr<MLIL_LOAD>().GetConstant<MLIL_EXTERN_PTR>()); + return false; // Done parsing this + } break; default: break; |
