about summary refs log tree commit diff stats
path: root/example/expression/export_llvm.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/export_llvm.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/export_llvm.py')
-rw-r--r--example/expression/export_llvm.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/example/expression/export_llvm.py b/example/expression/export_llvm.py
index 241a907d..a4c65787 100644
--- a/example/expression/export_llvm.py
+++ b/example/expression/export_llvm.py
@@ -6,18 +6,19 @@ from miasm.analysis.machine import Machine
 from miasm.jitter.llvmconvert import LLVMType, LLVMContext_IRCompilation, LLVMFunction_IRCompilation
 from llvmlite import ir as llvm_ir
 from miasm.expression.simplifications import expr_simp_high_to_explicit
+from miasm.core.locationdb import LocationDB
 
 parser = ArgumentParser("LLVM export example")
 parser.add_argument("target", help="Target binary")
 parser.add_argument("addr", help="Target address")
 parser.add_argument("--architecture", "-a", help="Force architecture")
 args = parser.parse_args()
-
+loc_db = LocationDB()
 # This part focus on obtaining an IRCFG to transform #
-cont = Container.from_stream(open(args.target, 'rb'))
+cont = Container.from_stream(open(args.target, 'rb'), loc_db)
 machine = Machine(args.architecture if args.architecture else cont.arch)
-ir = machine.ir(cont.loc_db)
-dis = machine.dis_engine(cont.bin_stream, loc_db=cont.loc_db)
+ir = machine.ir(loc_db)
+dis = machine.dis_engine(cont.bin_stream, loc_db=loc_db)
 asmcfg = dis.dis_multiblock(int(args.addr, 0))
 ircfg = ir.new_ircfg_from_asmcfg(asmcfg)
 ircfg.simplify(expr_simp_high_to_explicit)