From 5d10f696e0e278318c37d386225dd5c2945a952b Mon Sep 17 00:00:00 2001 From: Caroline Leman Date: Fri, 10 Mar 2017 15:45:01 +0100 Subject: analysis: Introduction of use-definition chains - previous dead_simp function has been moved to data_flow.py - ira class has been simplified - reach analysis code has been 'clarified' --- example/disasm/full.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'example/disasm/full.py') diff --git a/example/disasm/full.py b/example/disasm/full.py index 79db46d4..b919310a 100644 --- a/example/disasm/full.py +++ b/example/disasm/full.py @@ -8,6 +8,7 @@ from miasm2.core.asmblock import log_asmblock, AsmLabel, AsmCFG from miasm2.expression.expression import ExprId from miasm2.core.interval import interval from miasm2.analysis.machine import Machine +from miasm2.analysis.data_flow import dead_simp, DiGraphDefUse, ReachingDefinitions log = logging.getLogger("dis") console_handler = logging.StreamHandler() @@ -52,6 +53,9 @@ parser.add_argument('-i', "--image", action="store_true", help="Display image representation of disasm") parser.add_argument('-c', "--rawbinary", default=False, action="store_true", help="Don't interpret input as ELF/PE/...") +parser.add_argument('-d', "--defuse", action="store_true", + help="Dump the def-use graph in file 'defuse.dot'." + "The defuse is dumped after simplifications if -s option is specified") args = parser.parse_args() @@ -207,7 +211,11 @@ if args.gen_ir: print block if args.simplify: - ir_arch_a.dead_simp() + dead_simp(ir_arch_a) + + if args.defuse: + reachings = ReachingDefinitions(ir_arch_a) + open('graph_defuse.dot', 'w').write(DiGraphDefUse(reachings).dot()) out = ir_arch_a.graph.dot() open('graph_irflow.dot', 'w').write(out) -- cgit 1.4.1