diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2017-03-29 13:03:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-29 13:03:54 +0200 |
| commit | cedf19e7d73ca8d603f2e1ed7f5306db27678e65 (patch) | |
| tree | 83b742874821aa7b7e22eb753619b25908d4b94e /example/disasm/full.py | |
| parent | 519ff151baef8adff65674508c303cb125b8fd54 (diff) | |
| parent | 5d10f696e0e278318c37d386225dd5c2945a952b (diff) | |
| download | miasm-cedf19e7d73ca8d603f2e1ed7f5306db27678e65.tar.gz miasm-cedf19e7d73ca8d603f2e1ed7f5306db27678e65.zip | |
Merge pull request #508 from carolineLe/def_use
analysis: Introduction of use-definition chains
Diffstat (limited to 'example/disasm/full.py')
| -rw-r--r-- | example/disasm/full.py | 10 |
1 files changed, 9 insertions, 1 deletions
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) |