NationalSecurityAgency/ghidra · error · ValueError

Address {address} is not in process {proc}

Error message

Address {address} is not in process {proc}

What it means

Raised as ValueError by DefaultMemoryMapper.map_back() when the given Address belongs to an address space other than the mapper's single configured defaultSpace ('ram'). The default mapper cannot translate cross-space addresses back to a process offset.

Source

Thrown at Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/arch.py:168

def compute_ghidra_lcsp() -> Tuple[str, str]:
    lang = compute_ghidra_language()
    comp = compute_ghidra_compiler(lang)
    return lang, comp


class DefaultMemoryMapper(object):

    def __init__(self, defaultSpace: str) -> None:
        self.defaultSpace = defaultSpace

    def map(self, proc: int, offset: int) -> Tuple[str, Address]:
        space = self.defaultSpace
        return self.defaultSpace, Address(space, offset)

    def map_back(self, proc: int, address: Address) -> int:
        if address.space == self.defaultSpace:
            return address.offset
        raise ValueError(
            f"Address {address} is not in process {proc}")


DEFAULT_MEMORY_MAPPER = DefaultMemoryMapper('ram')

memory_mappers: Dict[str, DefaultMemoryMapper] = {}


def compute_memory_mapper(lang: str) -> DefaultMemoryMapper:
    if not lang in memory_mappers:
        return DEFAULT_MEMORY_MAPPER
    return memory_mappers[lang]


class DefaultRegisterMapper(object):

    def __init__(self, byte_order: str) -> None:
        if not byte_order in ['big', 'little']:

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Register a language-specific mapper in arch.memory_mappers that handles the target's address spaces.
  2. Ensure the Address passed to map_back() was produced by the matching map() call (same space).
  3. Check address.space == mapper.defaultSpace before invoking map_back().

Example fix

// before
offset = mapper.map_back(proc, address)  # address.space != 'ram'
// after
if address.space != mapper.defaultSpace:
    raise ValueError(f"{address} not in space {mapper.defaultSpace}")
offset = mapper.map_back(proc, address)
Defensive patterns

Strategy: validation

Validate before calling

mapper = arch.compute_memory_mapper(lang)
if address.space != mapper.defaultSpace:
    raise ValueError(f'{address} not in default space {mapper.defaultSpace}')
offset = mapper.map_back(proc, address)

Type guard

def address_in_space(address, mapper) -> bool:
    return getattr(address, 'space', None) == mapper.defaultSpace

Try / catch

try:
    offset = mapper.map_back(proc, address)
except ValueError as e:
    log.warning('cannot map address %s back: %s', address, e)
    return None

Prevention

When it happens

Trigger: Calling map_back() with an Address whose .space differs from the default space, on a target for which no language-specific memory mapper was registered in arch.memory_mappers.

Common situations: A multi-space target (e.g. with I/O or register spaces) where compute_memory_mapper() fell back to DEFAULT_MEMORY_MAPPER because the language id is not in memory_mappers; passing a register-space address into a memory operation.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/7a1f677b7d584692. Report an issue: GitHub.