mapfile-parser
raw JSON → 2.12.1 verified Fri May 01 auth: no python
Map file parser library focused on decompilation projects. Supports GNU, mwld, and other map file formats. Current version: 2.12.1. Release cadence: frequent (multiple releases per month).
pip install mapfile-parser Common errors
error ModuleNotFoundError: No module named 'mapfile_parser' ↓
cause The package is installed under the name 'mapfile-parser', but Python expects 'mapfile_parser'.
fix
Install the library: pip install mapfile-parser
error AttributeError: 'MapFile' object has no attribute 'readMapFile' ↓
cause Older versions used a different method name; the API may have changed.
fix
Check the installed version: pip show mapfile-parser. For >=2.9.0, use
MapFile.readMapFile(path). For older versions, refer to documentation. Warnings
gotcha When using GNU mapfiles, the library may automatically infer ROM addresses for sections/segments even if not explicitly present. This can lead to incorrect addresses if the mapfile is incomplete. Always verify against original binary. ↓
fix Manually check the inferred addresses by dumping the parsed sections.
gotcha Static symbols are inferred by default, which may cause false positives or missing symbols. The inference can be controlled via options. ↓
fix Use `MapFile(read_statics=False)` to disable static inference, or adjust via the `SymbolTypes` enum.
breaking In version 2.12.0, a CLI script `mapfile_parser` is installed via pip entry point. This may conflict with existing scripts named 'mapfile_parser' in the user's PATH. ↓
fix Rename any conflicting scripts or use `python3 -m mapfile_parser` instead of the bare command.
Imports
- MapFile
from mapfile_parser import MapFile - SymbolTypes
from mapfile_parser import SymbolTypes
Quickstart
from mapfile_parser import MapFile
# Parse a map file (e.g., GNU .map or mwld .map)
mf = MapFile()
mf.readMapFile('path/to/mapfile.map')
print(mf)
# Access symbols
for segment in mf.segments:
for section in segment.sections:
for symbol in section.symbols:
if symbol.name and 'NON_MATCHING' not in symbol.name:
print(symbol.name, hex(symbol.vram))