about summary refs log tree commit diff stats
path: root/example/symbol_exec/depgraph.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2018-06-22 19:49:09 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2018-07-05 16:14:26 +0200
commit195c688da01add6d4d964addfe7e34bea78bdb03 (patch)
tree80b346193da5609d19cdfc389ea84ad66399fa67 /example/symbol_exec/depgraph.py
parent3e86fb7046eef0adef023207cb4875174b26beea (diff)
downloadmiasm-195c688da01add6d4d964addfe7e34bea78bdb03.tar.gz
miasm-195c688da01add6d4d964addfe7e34bea78bdb03.zip
IR: gen ircfg from ir_arch
Diffstat (limited to 'example/symbol_exec/depgraph.py')
-rw-r--r--example/symbol_exec/depgraph.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/example/symbol_exec/depgraph.py b/example/symbol_exec/depgraph.py
index 88540a83..f306e6e3 100644
--- a/example/symbol_exec/depgraph.py
+++ b/example/symbol_exec/depgraph.py
@@ -62,18 +62,19 @@ if args.rename_args:
 asmcfg = mdis.dis_multiblock(int(args.func_addr, 0))
 
 # Generate IR
-for block in asmcfg.blocks:
-    ir_arch.add_block(block)
+ircfg = ir_arch.new_ircfg_from_asmcfg(asmcfg)
 
 # Get the instance
-dg = DependencyGraph(ir_arch, implicit=args.implicit,
-                     apply_simp=not args.do_not_simplify,
-                     follow_mem=not args.unfollow_mem,
-                     follow_call=not args.unfollow_call)
+dg = DependencyGraph(
+    ircfg, implicit=args.implicit,
+    apply_simp=not args.do_not_simplify,
+    follow_mem=not args.unfollow_mem,
+    follow_call=not args.unfollow_call
+)
 
 # Build information
 target_addr = int(args.target_addr, 0)
-current_block = list(ir_arch.getby_offset(target_addr))[0]
+current_block = list(ircfg.getby_offset(target_addr))[0]
 assignblk_index = 0
 for assignblk_index, assignblk in enumerate(current_block):
     if assignblk.instr.offset == target_addr:
@@ -86,7 +87,7 @@ for sol_nb, sol in enumerate(dg.get(current_block.loc_key, elements, assignblk_i
     with open(fname, "w") as fdesc:
             fdesc.write(sol.graph.dot())
 
-    results = sol.emul(ctx=init_ctx)
+    results = sol.emul(ir_arch, ctx=init_ctx)
     tokens = {str(k): str(v) for k, v in results.iteritems()}
     if not args.json:
         result = ", ".join("=".join(x) for x in tokens.iteritems())