about summary refs log tree commit diff stats
path: root/example/ida/depgraph.py
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2020-10-30 17:55:14 +0100
committerGitHub <noreply@github.com>2020-10-30 17:55:14 +0100
commitbd2e579f6633e4c6617cf972b559421f0343f6e5 (patch)
treee89b30eac8dee961a9e442d6d0a3425f41b6f314 /example/ida/depgraph.py
parentb8af43b26480b65d25f6fc3832884fa1df4db4d0 (diff)
parenteba583bfb85978d7eadd2eb53095e4100e095f60 (diff)
downloadmiasm-bd2e579f6633e4c6617cf972b559421f0343f6e5.tar.gz
miasm-bd2e579f6633e4c6617cf972b559421f0343f6e5.zip
Merge pull request #1306 from serpilliere/fix_ida_example
Fix ida examples
Diffstat (limited to 'example/ida/depgraph.py')
-rw-r--r--example/ida/depgraph.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/example/ida/depgraph.py b/example/ida/depgraph.py
index 65b57e89..e98d64c5 100644
--- a/example/ida/depgraph.py
+++ b/example/ida/depgraph.py
@@ -15,6 +15,7 @@ import ida_kernwin
 from miasm.core.bin_stream_ida import bin_stream_ida
 from miasm.core.asmblock import *
 from miasm.expression import expression as m2_expr
+from miasm.core.locationdb import LocationDB
 
 from miasm.expression.simplifications import expr_simp
 from miasm.analysis.depgraph import DependencyGraph
@@ -216,14 +217,16 @@ def launch_depgraph():
     mn, dis_engine, ira = machine.mn, machine.dis_engine, machine.ira
 
     bs = bin_stream_ida()
-    mdis = dis_engine(bs, dont_dis_nulstart_bloc=True)
-    ir_arch = ira(mdis.loc_db)
+    loc_db = LocationDB()
+
+    mdis = dis_engine(bs, loc_db=loc_db, dont_dis_nulstart_bloc=True)
+    ir_arch = ira(loc_db)
 
     # Populate symbols with ida names
     for ad, name in idautils.Names():
         if name is None:
             continue
-        mdis.loc_db.add_location(name, ad)
+        loc_db.add_location(name, ad)
 
     asmcfg = mdis.dis_multiblock(func.start_ea)
 
@@ -238,7 +241,7 @@ def launch_depgraph():
     # Simplify assignments
     for irb in list(viewvalues(ircfg.blocks)):
         irs = []
-        offset = ir_arch.loc_db.get_location_offset(irb.loc_key)
+        offset = loc_db.get_location_offset(irb.loc_key)
         fix_stack = offset is not None and settings.unalias_stack
         for assignblk in irb:
             if fix_stack:
@@ -259,7 +262,7 @@ def launch_depgraph():
     # Get dependency graphs
     dg = settings.depgraph
     graphs = dg.get(loc_key, elements, line_nb,
-                    set([ir_arch.loc_db.get_offset_location(func.start_ea)]))
+                    set([loc_db.get_offset_location(func.start_ea)]))
 
     # Display the result
     comments = {}