about summary refs log tree commit diff stats
path: root/miasm/core/parse_asm.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2020-08-22 12:47:01 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2020-08-31 07:50:01 +0200
commit80e40a3d2ca735db955807ad0605b43ca22e4e35 (patch)
tree4d41d7b53565f833444d3520eb22eed3e8bf26f1 /miasm/core/parse_asm.py
parent5d8beb271d9890241a6d61dd476fab26ca37ebbf (diff)
downloadfocaccia-miasm-80e40a3d2ca735db955807ad0605b43ca22e4e35.tar.gz
focaccia-miasm-80e40a3d2ca735db955807ad0605b43ca22e4e35.zip
Avoid generate default locationdb
Diffstat (limited to 'miasm/core/parse_asm.py')
-rw-r--r--miasm/core/parse_asm.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/miasm/core/parse_asm.py b/miasm/core/parse_asm.py
index b742a2d2..509f0483 100644
--- a/miasm/core/parse_asm.py
+++ b/miasm/core/parse_asm.py
@@ -88,21 +88,16 @@ def asm_ast_to_expr_with_size(arg, loc_db, size):
         return ExprInt(arg.value, size)
     return None
 
-def parse_txt(mnemo, attrib, txt, loc_db=None):
-    """Parse an assembly listing. Returns a couple (asmcfg, loc_db), where
-    asmcfg is an AsmCfg instance and loc_db the associated LocationDB
+def parse_txt(mnemo, attrib, txt, loc_db):
+    """Parse an assembly listing. Returns an AsmCfg instance
 
     @mnemo: architecture used
     @attrib: architecture attribute
     @txt: assembly listing
-    @loc_db: (optional) the LocationDB instance used to handle labels
-    of the listing
+    @loc_db: the LocationDB instance used to handle labels of the listing
 
     """
 
-    if loc_db is None:
-        loc_db = asmblock.LocationDB()
-
     C_NEXT = asmblock.AsmConstraint.c_next
     C_TO = asmblock.AsmConstraint.c_to
 
@@ -233,9 +228,9 @@ def parse_txt(mnemo, attrib, txt, loc_db=None):
                 # First line must be a label. If it's not the case, generate
                 # it.
                 loc = guess_next_new_label(loc_db)
-                cur_block = asmblock.AsmBlock(loc, alignment=mnemo.alignment)
+                cur_block = asmblock.AsmBlock(loc_db, loc, alignment=mnemo.alignment)
             else:
-                cur_block = asmblock.AsmBlock(line, alignment=mnemo.alignment)
+                cur_block = asmblock.AsmBlock(loc_db, line, alignment=mnemo.alignment)
                 i += 1
             # Generate the current block
             asmcfg.add_block(cur_block)
@@ -302,4 +297,4 @@ def parse_txt(mnemo, attrib, txt, loc_db=None):
 
         # Log block
         asmblock.log_asmblock.info(block)
-    return asmcfg, loc_db
+    return asmcfg