diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-06-18 09:27:45 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-06-19 16:42:46 +0200 |
| commit | f1b32ba2b8db22a5f92a2734af55e9a5dba2271e (patch) | |
| tree | 92facadca71fc07d7760c60d2ca877774c73579b /miasm2/expression/expression_reduce.py | |
| parent | 8f5ca332780cf9e08761060e9903bc085dbc8430 (diff) | |
| download | miasm-f1b32ba2b8db22a5f92a2734af55e9a5dba2271e.tar.gz miasm-f1b32ba2b8db22a5f92a2734af55e9a5dba2271e.zip | |
Example/ida: use addr to guess arch
Some arch like ARM depends on address in order to determine which attributes have to be used during analysis
Diffstat (limited to 'miasm2/expression/expression_reduce.py')
| -rw-r--r-- | miasm2/expression/expression_reduce.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/miasm2/expression/expression_reduce.py b/miasm2/expression/expression_reduce.py index 45386ca2..22ac8d8d 100644 --- a/miasm2/expression/expression_reduce.py +++ b/miasm2/expression/expression_reduce.py @@ -4,8 +4,8 @@ Apply reduction rules to an Expression ast """ import logging -from miasm2.expression.expression import ExprInt, ExprId, ExprOp, ExprSlice,\ - ExprCompose, ExprMem, ExprCond +from miasm2.expression.expression import ExprInt, ExprId, ExprLoc, ExprOp, \ + ExprSlice, ExprCompose, ExprMem, ExprCond log_reduce = logging.getLogger("expr_reduce") console_handler = logging.StreamHandler() @@ -29,7 +29,7 @@ class ExprNode(object): expr = self.expr if self.info is not None: out = repr(self.info) - elif expr.is_int() or expr.is_id(): + elif expr.is_int() or expr.is_id() or expr.is_loc(): out = str(expr) elif expr.is_mem(): out = "@%d[%r]" % (self.expr.size, self.arg) @@ -76,7 +76,7 @@ class ExprReducer(object): @expr: Expression to analyze """ - if isinstance(expr, (ExprId, ExprInt)): + if isinstance(expr, (ExprId, ExprLoc, ExprInt)): node = ExprNode(expr) elif isinstance(expr, (ExprMem, ExprSlice)): son = self.expr2node(expr.arg) @@ -118,7 +118,7 @@ class ExprReducer(object): expr = node.expr log_reduce.debug("\t" * lvl + "Reduce...: %s", node.expr) - if isinstance(expr, (ExprId, ExprInt)): + if isinstance(expr, (ExprId, ExprInt, ExprLoc)): pass elif isinstance(expr, ExprMem): arg = self.categorize(node.arg, lvl=lvl + 1, **kwargs) |