8.8.1.1.2.2.10. MemMap

class MemMap
get() MemoryMapResult

Fetches the memory map.

# Print the memory map
memMap = session.memory.memMap.get()
for entry in memMap["entries"]:
    attributes = ", ".join(entry["attributes"])
    print(f"{entry['start']} - {entry['end']}: {attributes}")
print(f"The memory map is {'enabled' if memMap['enabled'] else 'disabled'}")
Returns:

The memory map.

Return type:

MemoryMapResult

add(startLocation, length, readable, writable) None

Adds read or write permission for a range of target memory to the memory map.

# Add a range of memory to the memory map from 0x1000 to 0x1999 to be readable and not writable
session.memory.memMap.add(0x1000, 0x1000, True, False)
Parameters:
  • startLocation (DSLocation) -- The starting address of a range in memory.

  • length (Address) -- The length of the range.

  • readable (bool) -- Set to true to make this range readable. A memory range can be readable, writable or both.

  • writable (bool) -- Set to true to make this range writable. A memory range can be readable, writable or both.

Return type:

None

enable(mapOn) None

Toggles memory mapping on or off in the debugger server.

# Turn memory mapping on
session.memory.memMap.enable(True)

# Turn memory mapping off
session.memory.memMap.enable(False)
Parameters:

mapOn (bool) -- Set to true to turn memory mapping on, and false to turn memory mapping off. Default value is true.

Return type:

None

remove(location) None

Deletes a range of memory from the memory map.

# Assume you have a range of (0x000 - 0x1007) in the current memory map, then it can be removed by
session.memory.memMap.remove(0x100)
# or equivalently,
session.memory.memMap.remove(0x1000)
# or any other address in that range.
Parameters:

location (DSLocation) -- Identifies an address with a memory range already defined in the memory map.

Return type:

None

reset() None

Resets the memory map by making all memory non-readable and non-writeable.

session.memory.memMap.reset()
Return type:

None