about summary refs log tree commit diff stats
path: root/example/expression/access_c.py
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2020-08-31 09:27:56 +0200
committerGitHub <noreply@github.com>2020-08-31 09:27:56 +0200
commit06239dde95cd984548deb40e9945d8bd85d83425 (patch)
tree2fb59bca2aada9280fb1aecd2ebdd633a23cdc4b /example/expression/access_c.py
parent5d8beb271d9890241a6d61dd476fab26ca37ebbf (diff)
parent24ce193b8bad352853a9c5589f6fdcf5177d5466 (diff)
downloadmiasm-06239dde95cd984548deb40e9945d8bd85d83425.tar.gz
miasm-06239dde95cd984548deb40e9945d8bd85d83425.zip
Merge pull request #1274 from serpilliere/dont_gen_locationdb
Avoid generate default locationdb
Diffstat (limited to 'example/expression/access_c.py')
-rw-r--r--example/expression/access_c.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/example/expression/access_c.py b/example/expression/access_c.py
index c604a0bd..3cc8e6a2 100644
--- a/example/expression/access_c.py
+++ b/example/expression/access_c.py
@@ -55,6 +55,8 @@ from miasm.arch.x86.ctype import CTypeAMD64_unk
 from miasm.core.objc import ExprToAccessC, CHandler
 from miasm.core.objc import CTypesManagerNotPacked
 from miasm.core.ctypesmngr import CAstTypes, CTypePtr, CTypeStruct
+from miasm.core.locationdb import LocationDB
+
 
 def find_call(ircfg):
     """Returns (irb, index) which call"""
@@ -116,6 +118,7 @@ class MyCHandler(CHandler):
 
 
 
+loc_db = LocationDB()
 data = open(sys.argv[1], 'rb').read()
 # Digest C information
 text = """
@@ -143,12 +146,12 @@ cont = Container.fallback_container(data, None, addr=0)
 machine = Machine("x86_64")
 dis_engine, ira = machine.dis_engine, machine.ira
 
-mdis = dis_engine(cont.bin_stream, loc_db=cont.loc_db)
+mdis = dis_engine(cont.bin_stream, loc_db=loc_db)
 addr_head = 0
 asmcfg = mdis.dis_multiblock(addr_head)
-lbl_head = mdis.loc_db.get_offset_location(addr_head)
+lbl_head = loc_db.get_offset_location(addr_head)
 
-ir_arch_a = ira(mdis.loc_db)
+ir_arch_a = ira(loc_db)
 ircfg = ir_arch_a.new_ircfg_from_asmcfg(asmcfg)
 
 open('graph_irflow.dot', 'w').write(ircfg.dot())