about summary refs log tree commit diff stats
path: root/example/ida/ctype_propagation.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/ctype_propagation.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/ctype_propagation.py')
-rw-r--r--example/ida/ctype_propagation.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/example/ida/ctype_propagation.py b/example/ida/ctype_propagation.py
index 35cd53bb..1f55a975 100644
--- a/example/ida/ctype_propagation.py
+++ b/example/ida/ctype_propagation.py
@@ -17,6 +17,7 @@ from miasm.expression.expression import ExprLoc, ExprInt, ExprOp, ExprAssign
 from miasm.ir.symbexec_types import SymbExecCType
 from miasm.expression.parser import str_to_expr
 from miasm.analysis.cst_propag import add_state, propagate_cst_expr
+from miasm.core.locationdb import LocationDB
 
 from utils import guess_machine
 
@@ -264,13 +265,15 @@ def analyse_function():
     mn, dis_engine, ira = machine.mn, machine.dis_engine, machine.ira
 
     bs = bin_stream_ida()
-    mdis = dis_engine(bs, dont_dis_nulstart_bloc=True)
+    loc_db = LocationDB()
+
+    mdis = dis_engine(bs, loc_db=loc_db, dont_dis_nulstart_bloc=True)
     if end is not None:
         mdis.dont_dis = [end]
 
 
     iraCallStackFixer = get_ira_call_fixer(ira)
-    ir_arch = iraCallStackFixer(mdis.loc_db)
+    ir_arch = iraCallStackFixer(loc_db)
 
     asmcfg = mdis.dis_multiblock(addr)
     # Generate IR
@@ -308,8 +311,8 @@ def analyse_function():
         infos_types[expr] = set([objc])
 
     # Add fake head
-    lbl_real_start = ir_arch.loc_db.get_offset_location(addr)
-    lbl_head = ir_arch.loc_db.get_or_create_name_location("start")
+    lbl_real_start = loc_db.get_offset_location(addr)
+    lbl_head = loc_db.get_or_create_name_location("start")
 
     first_block = asmcfg.label2block(lbl_real_start)