diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2018-07-03 14:34:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-03 14:34:41 +0200 |
| commit | c0afde4d7c8ff51eaa31e4a074b9e06f080b3169 (patch) | |
| tree | 967c5856dcf37980cf80a2ea48cc7ee0e008e1bd /miasm2/analysis/binary.py | |
| parent | c7ca6a23768178dd49c8fe97d7c7b1e0be02cd2e (diff) | |
| parent | d314460a5a19be1f3334baedf0105d9b72fc8620 (diff) | |
| download | miasm-c0afde4d7c8ff51eaa31e4a074b9e06f080b3169.tar.gz miasm-c0afde4d7c8ff51eaa31e4a074b9e06f080b3169.zip | |
Merge pull request #787 from commial/feature/locationdb
LocationDB
Diffstat (limited to 'miasm2/analysis/binary.py')
| -rw-r--r-- | miasm2/analysis/binary.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/miasm2/analysis/binary.py b/miasm2/analysis/binary.py index 5d9374da..16e573bb 100644 --- a/miasm2/analysis/binary.py +++ b/miasm2/analysis/binary.py @@ -1,8 +1,9 @@ import logging +import warnings from miasm2.core.bin_stream import bin_stream_str, bin_stream_elf, bin_stream_pe from miasm2.jitter.csts import PAGE_READ -from miasm2.core.asmblock import AsmSymbolPool +from miasm2.core.locationdb import LocationDB log = logging.getLogger("binary") @@ -94,7 +95,7 @@ class Container(object): self._bin_stream = None self._entry_point = None self._arch = None - self._symbol_pool = AsmSymbolPool() + self._loc_db = LocationDB() # Launch parsing self.parse(*args, **kwargs) @@ -120,10 +121,15 @@ class Container(object): return self._arch @property - def symbol_pool(self): - "AsmSymbolPool instance preloaded with container symbols (if any)" - return self._symbol_pool + def loc_db(self): + "LocationDB instance preloaded with container symbols (if any)" + return self._loc_db + @property + def symbol_pool(self): + "[DEPRECATED API]" + warnings.warn("Deprecated API: use 'loc_db'") + return self.loc_db ## Format dependent classes class ContainerPE(Container): @@ -205,13 +211,13 @@ class ContainerELF(Container): if not name: continue try: - self._symbol_pool.add_location(name, offset) + self._loc_db.add_location(name, offset) except ValueError: # Two symbols points on the same offset log.warning("Same offset (%s) for %s and %s", (hex(offset), name, - self._symbol_pool.getby_offset(offset))) + self._loc_db.get_offset_location(offset))) continue |