about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2018-08-24 17:18:42 +0200
committerGitHub <noreply@github.com>2018-08-24 17:18:42 +0200
commit68ffd93563d885102d31b7023c0ee62f85df7146 (patch)
tree037ec62f470c19f3a9733b94eff34a85ca2af5b9
parent2ae7ffe2459adb872c27b434810f5f5673d8d68d (diff)
parent50c635a51f4d22099719d3303858a5a9147f889c (diff)
downloadmiasm-68ffd93563d885102d31b7023c0ee62f85df7146.tar.gz
miasm-68ffd93563d885102d31b7023c0ee62f85df7146.zip
Merge pull request #832 from serpilliere/add_name_loc
Core/Location: add name to a known location
-rw-r--r--miasm2/core/locationdb.py12
1 files changed, 3 insertions, 9 deletions
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