about summary refs log tree commit diff stats
path: root/example/expression/get_read_write.py
diff options
context:
space:
mode:
Diffstat (limited to 'example/expression/get_read_write.py')
-rw-r--r--example/expression/get_read_write.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/example/expression/get_read_write.py b/example/expression/get_read_write.py
index b4a0773b..9e3b5caf 100644
--- a/example/expression/get_read_write.py
+++ b/example/expression/get_read_write.py
@@ -1,6 +1,9 @@
 from miasm2.arch.x86.arch import mn_x86
 from miasm2.expression.expression import get_rw
 from miasm2.arch.x86.ira import ir_a_x86_32
+from miasm2.core.asmblock import AsmSymbolPool
+
+symbol_pool = AsmSymbolPool()
 
 
 print """
@@ -11,17 +14,18 @@ Get read/written registers for a given instruction
 arch = mn_x86
 ir_arch = ir_a_x86_32()
 
-l = arch.fromstring('LODSB', 32)
+l = arch.fromstring('LODSB', symbol_pool, 32)
 l.offset, l.l = 0, 15
 ir_arch.add_instr(l)
 
 print '*' * 80
-for lbl, irblock in ir_arch.blocks.items():
+for lbl, irblock in ir_arch.blocks.iteritems():
     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
+        rw = assignblk.get_rw()
+        for dst, reads in rw.iteritems():
+            print 'read:   ', [str(x) for x in reads]
+            print 'written:', dst
+            print
 
 open('graph_instr.dot', 'w').write(ir_arch.graph.dot())