diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2015-12-12 14:35:24 +0100 |
|---|---|---|
| committer | serpilliere <serpilliere@users.noreply.github.com> | 2015-12-12 14:35:24 +0100 |
| commit | b32eb145fce7dd09bef025a9f82b2507bd4e02ee (patch) | |
| tree | 2c65f005adb7830853664451aed3f2cd05a9be73 /example | |
| parent | 635f372fa846b28252ab86b344a2565f51e2302c (diff) | |
| parent | d95af9858230c41449d6fd487a93bdc337780ea7 (diff) | |
| download | miasm-b32eb145fce7dd09bef025a9f82b2507bd4e02ee.tar.gz miasm-b32eb145fce7dd09bef025a9f82b2507bd4e02ee.zip | |
Merge pull request #290 from commial/refactor-ira
Refactor ira
Diffstat (limited to 'example')
| -rw-r--r-- | example/disasm/full.py | 5 | ||||
| -rw-r--r-- | example/expression/asm_to_ir.py | 7 | ||||
| -rw-r--r-- | example/expression/get_read_write.py | 5 | ||||
| -rw-r--r-- | example/expression/graph_dataflow.py | 1 | ||||
| -rw-r--r-- | example/ida/depgraph.py | 3 | ||||
| -rw-r--r-- | example/ida/graph_ir.py | 6 | ||||
| -rw-r--r-- | example/symbol_exec/depgraph.py | 3 |
7 files changed, 9 insertions, 21 deletions
diff --git a/example/disasm/full.py b/example/disasm/full.py index 03928e73..33b2f41f 100644 --- a/example/disasm/full.py +++ b/example/disasm/full.py @@ -194,10 +194,11 @@ if args.gen_ir: log.info("Print blocs (with analyse)") for label, bloc in ir_arch_a.blocs.iteritems(): print bloc - ir_arch_a.gen_graph() if args.simplify: ir_arch_a.dead_simp() - out = ir_arch_a.graph() + out = ir_arch_a.graph.dot() open('graph_irflow.dot', 'w').write(out) + out = ir_arch.graph.dot() + open('graph_irflow_raw.dot', 'w').write(out) diff --git a/example/expression/asm_to_ir.py b/example/expression/asm_to_ir.py index 3ed59ffe..2f8999a4 100644 --- a/example/expression/asm_to_ir.py +++ b/example/expression/asm_to_ir.py @@ -45,13 +45,10 @@ for lbl, b in ir_arch.blocs.items(): print b # Dead propagation -ir_arch.gen_graph() -out = ir_arch.graph() -open('graph.dot', 'w').write(out) +open('graph.dot', 'w').write(ir_arch.graph.dot()) print '*' * 80 ir_arch.dead_simp() -out2 = ir_arch.graph() -open('graph2.dot', 'w').write(out2) +open('graph2.dot', 'w').write(ir_arch.graph.dot()) # Display new IR print 'new ir blocs' diff --git a/example/expression/get_read_write.py b/example/expression/get_read_write.py index f0f48015..d98b461a 100644 --- a/example/expression/get_read_write.py +++ b/example/expression/get_read_write.py @@ -21,6 +21,5 @@ for lbl, b in ir_arch.blocs.items(): print 'read: ', [str(x) for x in o_r] print 'written:', [str(x) for x in o_w] print -ir_arch.gen_graph() -g = ir_arch.graph() -open('graph_instr.dot', 'w').write(g) + +open('graph_instr.dot', 'w').write(ir_arch.graph.dot()) diff --git a/example/expression/graph_dataflow.py b/example/expression/graph_dataflow.py index e263a40e..64801e52 100644 --- a/example/expression/graph_dataflow.py +++ b/example/expression/graph_dataflow.py @@ -114,7 +114,6 @@ def gen_bloc_data_flow_graph(ir_arch, ad, block_flow_cb): for irbloc in ir_arch.blocs.values(): print irbloc - ir_arch.gen_graph() ir_arch.dead_simp() irbloc_0 = None diff --git a/example/ida/depgraph.py b/example/ida/depgraph.py index 03eea3d5..406f7200 100644 --- a/example/ida/depgraph.py +++ b/example/ida/depgraph.py @@ -136,9 +136,6 @@ for irb in ir_arch.blocs.values(): for i, expr in enumerate(irs): irs[i] = m2_expr.ExprAff(expr_simp(expr.dst), expr_simp(expr.src)) -# Build the IRA Graph -ir_arch.gen_graph() - # Get settings settings = depGraphSettingsForm(ir_arch) settings.Execute() diff --git a/example/ida/graph_ir.py b/example/ida/graph_ir.py index c3d88c36..b181f72a 100644 --- a/example/ida/graph_ir.py +++ b/example/ida/graph_ir.py @@ -56,7 +56,7 @@ class GraphMiasmIR(GraphViewer): continue dst = ir_arch.dst_trackback(irbloc) for d in dst: - if not self.ir_arch.ExprIsLabel(d): + if not expr_is_label(d): continue d = d.name @@ -138,8 +138,7 @@ for irb in ir_arch.blocs.values(): for i, expr in enumerate(irs): irs[i] = ExprAff(expr_simp(expr.dst), expr_simp(expr.src)) -ir_arch.gen_graph() -out = ir_arch.graph() +out = ir_arch.graph.dot() open(os.path.join(tempfile.gettempdir(), 'graph.dot'), 'wb').write(out) @@ -197,7 +196,6 @@ def get_modified_symbols(sb): def gen_bloc_data_flow_graph(ir_arch, in_str, ad): # arch, attrib, pool_bin, bloc, symbol_pool): out_str = "" - ir_arch.gen_graph() # ir_arch.dead_simp() irbloc_0 = None diff --git a/example/symbol_exec/depgraph.py b/example/symbol_exec/depgraph.py index 6aa9cf81..a870b275 100644 --- a/example/symbol_exec/depgraph.py +++ b/example/symbol_exec/depgraph.py @@ -61,9 +61,6 @@ blocks = mdis.dis_multibloc(int(args.func_addr, 0)) for block in blocks: ir_arch.add_bloc(block) -# Build the IRA Graph -ir_arch.gen_graph() - # Get the instance dg = DependencyGraph(ir_arch, implicit=args.implicit, apply_simp=not(args.do_not_simplify), |