8.8.1.1.1.2.10. MemMap

interface MemMap()
get()

Fetches the memory map.

// Print the memory map
const { entries, enabled } = session.memory.memMap.get();
for (const entry of entries) {
          const attributes = entry.attributes.join(', ')
    console.log(`${entry.start} - ${entry.end}: ${attributes}`);
}
console.log(`The memory map is ${enabled ? "enabled" : "disabled"}`);
Returns:

The memory map.

Return type:

MemoryMapResult

add(startLocation: DSLocation, length: Address, readable: boolean, writable: boolean)

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 (boolean) -- Set to true to make this range readable. A memory range can be readable, writable or both.

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

Return type:

void

enable(mapOn: boolean)

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 (boolean) -- Set to true to turn memory mapping on, and false to turn memory mapping off. Default value is true.

Return type:

void

remove(location: DSLocation)

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:

void

reset()

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

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

void