about summary refs log tree commit diff stats
path: root/example/asm
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/asm
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/asm')
-rwxr-xr-xexample/asm/shellcode.py3
-rw-r--r--example/asm/simple.py12
2 files changed, 9 insertions, 6 deletions
diff --git a/example/asm/shellcode.py b/example/asm/shellcode.py
index 67c882e9..70d844a9 100755
--- a/example/asm/shellcode.py
+++ b/example/asm/shellcode.py
@@ -83,7 +83,7 @@ with open(args.source) as fstream:
 
 loc_db = LocationDB()
 
-asmcfg, loc_db = parse_asm.parse_txt(machine.mn, attrib, source, loc_db)
+asmcfg = parse_asm.parse_txt(machine.mn, attrib, source, loc_db)
 
 # Fix shellcode addrs
 loc_db.set_location_offset(loc_db.get_name_location("main"), addr_main)
@@ -106,7 +106,6 @@ open("graph.dot", "w").write(asmcfg.dot())
 patches = asmblock.asm_resolve_final(
     machine.mn,
     asmcfg,
-    loc_db,
     dst_interval
 )
 if args.encrypt:
diff --git a/example/asm/simple.py b/example/asm/simple.py
index 8f6aac92..bfa3ace6 100644
--- a/example/asm/simple.py
+++ b/example/asm/simple.py
@@ -4,10 +4,12 @@ from pprint import pprint
 
 from miasm.arch.x86.arch import mn_x86
 from miasm.core import parse_asm, asmblock
-
+from miasm.core.locationdb import LocationDB
 
 # Assemble 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
@@ -20,13 +22,15 @@ loop:
    ADD    EAX, ECX
    JZ     loop
    RET
-''')
+''',
+    loc_db
+)
 
 # Set 'main' loc_key's offset
 loc_db.set_location_offset(loc_db.get_name_location("main"), 0x0)
 
 # Spread information and resolve instructions offset
-patches = asmblock.asm_resolve_final(mn_x86, asmcfg, loc_db)
+patches = asmblock.asm_resolve_final(mn_x86, asmcfg)
 
 # Show resolved asmcfg
 for block in asmcfg.blocks: