about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-04-30 18:06:06 +0200
committerAjax <commial@gmail.com>2015-04-30 19:12:43 +0200
commit039c2ca9d9a4e2359b3a4c004b1df821cc38f489 (patch)
tree2a88424bbb5387c83fddf9104d03e3cd8f29e57d
parent7c4b58d2fb424df01bf71ba3ec644b41fcc9a2d0 (diff)
downloadmiasm-039c2ca9d9a4e2359b3a4c004b1df821cc38f489.tar.gz
miasm-039c2ca9d9a4e2359b3a4c004b1df821cc38f489.zip
GraphDataflow: A function where never executed / tested
-rw-r--r--example/expression/graph_dataflow.py14
-rw-r--r--test/test_all.py9
2 files changed, 15 insertions, 8 deletions
diff --git a/example/expression/graph_dataflow.py b/example/expression/graph_dataflow.py
index a4f26aec..1450b33b 100644
--- a/example/expression/graph_dataflow.py
+++ b/example/expression/graph_dataflow.py
@@ -13,6 +13,8 @@ from miasm2.ir.symbexec import symbexec
 parser = ArgumentParser("Simple expression use for generating dataflow graph")
 parser.add_argument("filename", help="File to analyse")
 parser.add_argument("addr", help="Function's address")
+parser.add_argument("-s", "--symb", help="Symbolic execution mode",
+                    action="store_true")
 args = parser.parse_args()
 
 
@@ -108,7 +110,7 @@ def node2str(self, node):
     return out
 
 
-def gen_bloc_data_flow_graph(ir_arch, ad):
+def gen_bloc_data_flow_graph(ir_arch, ad, block_flow_cb):
     for irbloc in ir_arch.blocs.values():
         print irbloc
 
@@ -125,8 +127,7 @@ def gen_bloc_data_flow_graph(ir_arch, ad):
     flow_graph.node2str = lambda n: node2str(flow_graph, n)
 
     for irbloc in ir_arch.blocs.values():
-        intra_bloc_flow_raw(ir_arch, flow_graph, irbloc)
-        # intra_bloc_flow_symb(ir_arch, flow_graph, irbloc)
+        block_flow_cb(ir_arch, flow_graph, irbloc)
 
     for irbloc in ir_arch.blocs.values():
         print irbloc
@@ -164,7 +165,12 @@ for irbloc in ir_arch.blocs.values():
         continue
 
 
-gen_bloc_data_flow_graph(ir_arch, ad)
+if args.symb:
+    block_flow_cb = intra_bloc_flow_symb
+else:
+    block_flow_cb = intra_bloc_flow_raw
+
+gen_bloc_data_flow_graph(ir_arch, ad, block_flow_cb)
 
 print '*' * 40
 print """
diff --git a/test/test_all.py b/test/test_all.py
index f52856a3..7082e3d7 100644
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -294,10 +294,11 @@ class ExampleExpression(Example):
     example_dir = "expression"
 
 
-testset += ExampleExpression(["graph_dataflow.py",
-                              Example.get_sample("sc_connect_back.bin"),
-                              "0x2e"],
-                             products=["data.txt"])
+for args in [[], ["--symb"]]:
+    testset += ExampleExpression(["graph_dataflow.py",
+                                  Example.get_sample("sc_connect_back.bin"),
+                                  "0x2e"] + args,
+                                 products=["data.txt"])
 testset += ExampleExpression(["asm_to_ir.py"],
                              products=["graph.txt", "graph2.txt"])
 testset += ExampleExpression(["get_read_write.py"],