diff options
Diffstat (limited to 'example/expression')
| -rw-r--r-- | example/expression/access_c.py | 8 | ||||
| -rw-r--r-- | example/expression/basic_simplification.py | 4 | ||||
| -rw-r--r-- | example/expression/expr_grapher.py | 8 | ||||
| -rw-r--r-- | example/expression/expr_reduce.py | 2 | ||||
| -rw-r--r-- | example/expression/get_read_write.py | 8 | ||||
| -rw-r--r-- | example/expression/simplification_add.py | 2 | ||||
| -rw-r--r-- | example/expression/simplification_tools.py | 10 | ||||
| -rw-r--r-- | example/expression/solve_condition_stp.py | 2 |
8 files changed, 22 insertions, 22 deletions
diff --git a/example/expression/access_c.py b/example/expression/access_c.py index f285eb55..de158730 100644 --- a/example/expression/access_c.py +++ b/example/expression/access_c.py @@ -60,15 +60,15 @@ def find_call(ira): for irb in ira.blocks.values(): out = set() - if len(irb.irs) < 2: + if len(irb) < 2: continue - assignblk = irb.irs[-2] + assignblk = irb[-2] for src in assignblk.itervalues(): if not isinstance(src, ExprOp): continue if not src.op.startswith('call_func'): continue - out.add((irb, len(irb.irs) - 2)) + out.add((irb, len(irb) - 2)) if len(out) != 1: continue irb, index = out.pop() @@ -98,7 +98,7 @@ def get_funcs_arg0(ctx, ira, lbl_head): element = ira.arch.regs.RSI for irb, index in find_call(ira): - instr = irb.irs[index].instr + instr = irb[index].instr print 'Analysing references from:', hex(instr.offset), instr g_list = g_dep.get(irb.label, set([element]), index, set([lbl_head])) for dep in g_list: diff --git a/example/expression/basic_simplification.py b/example/expression/basic_simplification.py index ef904686..eefdc765 100644 --- a/example/expression/basic_simplification.py +++ b/example/expression/basic_simplification.py @@ -6,8 +6,8 @@ Simple expression simplification demo """ -a = ExprId('eax') -b = ExprId('ebx') +a = ExprId('eax', 32) +b = ExprId('ebx', 32) exprs = [a + b - a, ExprInt(0x12, 32) + ExprInt(0x30, 32) - a, diff --git a/example/expression/expr_grapher.py b/example/expression/expr_grapher.py index 0de2142b..9bf6cd84 100644 --- a/example/expression/expr_grapher.py +++ b/example/expression/expr_grapher.py @@ -2,10 +2,10 @@ from miasm2.expression.expression import * print "Simple Expression grapher demo" -a = ExprId("A") -b = ExprId("B") -c = ExprId("C") -d = ExprId("D") +a = ExprId("A", 32) +b = ExprId("B", 32) +c = ExprId("C", 32) +d = ExprId("D", 32) m = ExprMem(a + b + c + a) e1 = ExprCompose(a + b - (c * a) / m | b, a + m) diff --git a/example/expression/expr_reduce.py b/example/expression/expr_reduce.py index bb94ceb9..7c6e0c4c 100644 --- a/example/expression/expr_reduce.py +++ b/example/expression/expr_reduce.py @@ -75,7 +75,7 @@ class StructLookup(ExprReducer): def test(): struct_lookup = StructLookup() - ptr = ExprId('ECX') + ptr = ExprId('ECX', 32) int4 = ExprInt(4, 32) tests = [ (ptr, StructLookup.FIELD_A_PTR), diff --git a/example/expression/get_read_write.py b/example/expression/get_read_write.py index f4dde4b5..b4a0773b 100644 --- a/example/expression/get_read_write.py +++ b/example/expression/get_read_write.py @@ -16,10 +16,10 @@ l.offset, l.l = 0, 15 ir_arch.add_instr(l) print '*' * 80 -for lbl, b in ir_arch.blocks.items(): - print b - for irs in b.irs: - o_r, o_w = get_rw(irs) +for lbl, irblock in ir_arch.blocks.items(): + print irblock + for assignblk in irblock: + o_r, o_w = get_rw(assignblk) print 'read: ', [str(x) for x in o_r] print 'written:', [str(x) for x in o_w] print diff --git a/example/expression/simplification_add.py b/example/expression/simplification_add.py index 41720f3a..621d1139 100644 --- a/example/expression/simplification_add.py +++ b/example/expression/simplification_add.py @@ -30,7 +30,7 @@ def simp_add_mul(expr_simp, expr): # Do not simplify return expr -a = m2_expr.ExprId('a') +a = m2_expr.ExprId('a', 32) base_expr = a + a + a print "Without adding the simplification:" print "\t%s = %s" % (base_expr, expr_simp(base_expr)) diff --git a/example/expression/simplification_tools.py b/example/expression/simplification_tools.py index 258b5ce4..1fb95a80 100644 --- a/example/expression/simplification_tools.py +++ b/example/expression/simplification_tools.py @@ -7,11 +7,11 @@ Expression simplification demo. """ -a = ExprId('a') -b = ExprId('b') -c = ExprId('c') -d = ExprId('d') -e = ExprId('e') +a = ExprId('a', 32) +b = ExprId('b', 32) +c = ExprId('c', 32) +d = ExprId('d', 32) +e = ExprId('e', 32) m = ExprMem(a) s = a[:8] diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py index b3ee6938..24d2dd50 100644 --- a/example/expression/solve_condition_stp.py +++ b/example/expression/solve_condition_stp.py @@ -109,7 +109,7 @@ if __name__ == '__main__': argc = ExprId('argc', 32) argv = ExprId('argv', 32) - ret_addr = ExprId('ret_addr') + ret_addr = ExprId('ret_addr', 32) reg_and_id[argc.name] = argc reg_and_id[argv.name] = argv reg_and_id[ret_addr.name] = ret_addr |