diff options
| -rw-r--r-- | miasm2/core/cpu.py | 4 | ||||
| -rw-r--r-- | miasm2/core/locationdb.py | 12 | ||||
| -rw-r--r-- | miasm2/core/parse_asm.py | 3 |
3 files changed, 7 insertions, 12 deletions
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py index 686e12ba..8491c5c8 100644 --- a/miasm2/core/cpu.py +++ b/miasm2/core/cpu.py @@ -1030,6 +1030,10 @@ class instruction(object): if '_' in names: fixed_expr[exprloc] = self.get_asm_next_offset(exprloc) continue + arg_int = symbols.get_location_offset(loc_key) + if arg_int is not None: + fixed_expr[exprloc] = m2_expr.ExprInt(arg_int, exprloc.size) + continue if not names: raise ValueError('Unresolved symbol: %r' % exprloc) diff --git a/miasm2/core/locationdb.py b/miasm2/core/locationdb.py index 21e2d713..7d84c491 100644 --- a/miasm2/core/locationdb.py +++ b/miasm2/core/locationdb.py @@ -214,7 +214,7 @@ class LocationDB(object): raised. Otherwise: If a location with @offset or @name already exists, the corresponding - LocKey will be returned. + LocKey may be updated and will be returned. """ # Deprecation handling @@ -262,14 +262,8 @@ class LocationDB(object): elif offset_loc_key is not None: if name is not None: - # This is an error. Check for already known name are checked above - raise ValueError( - "Location with offset 0x%x already exists." - "To add a name to this location, use the dedicated API" - "'add_location_name(%r, %r)'" % ( - offset_loc_key, - name - )) + # Check for already known name are checked above + return self.add_location_name(offset_loc_key, name) # Offset already known, no name specified return offset_loc_key diff --git a/miasm2/core/parse_asm.py b/miasm2/core/parse_asm.py index 7efa17d0..aeb5d219 100644 --- a/miasm2/core/parse_asm.py +++ b/miasm2/core/parse_asm.py @@ -199,9 +199,6 @@ def parse_txt(mnemo, attrib, txt, loc_db=None): line = line[:line.find(';')] line = line.strip(' ').strip('\t') instr = mnemo.fromstring(line, loc_db, attrib) - - if instr.dstflow(): - instr.dstflow2label(loc_db) lines.append(instr) asmblock.log_asmblock.info("___pre asm oki___") |