about summary refs log tree commit diff stats
path: root/example/expression/asm_to_ir.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/asm_to_ir.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/asm_to_ir.py')
-rw-r--r--example/expression/asm_to_ir.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/example/expression/asm_to_ir.py b/example/expression/asm_to_ir.py
index 83eac728..8ecc4f24 100644
--- a/example/expression/asm_to_ir.py
+++ b/example/expression/asm_to_ir.py
@@ -9,10 +9,13 @@ from miasm.expression.expression import *
 from miasm.core import asmblock
 from miasm.arch.x86.ira import ir_a_x86_32
 from miasm.analysis.data_flow import DeadRemoval
+from miasm.core.locationdb import LocationDB
 
 
 # First, asm code
-asmcfg, loc_db = parse_asm.parse_txt(mn_x86, 32, '''
+loc_db = LocationDB()
+asmcfg = parse_asm.parse_txt(
+    mn_x86, 32, '''
 main:
    MOV    EAX, 1
    MOV    EBX, 2
@@ -25,7 +28,9 @@ loop:
    ADD    EAX, ECX
    JZ     loop
    RET
-''')
+''',
+    loc_db
+)
 
 
 loc_db.set_location_offset(loc_db.get_name_location("main"), 0x0)
@@ -35,7 +40,7 @@ for block in asmcfg.blocks:
 
 print("symbols:")
 print(loc_db)
-patches = asmblock.asm_resolve_final(mn_x86, asmcfg, loc_db)
+patches = asmblock.asm_resolve_final(mn_x86, asmcfg)
 
 # Translate to IR
 ir_arch = ir_a_x86_32(loc_db)