{"record":{"id":"7a1f677b7d584692","repo":"NationalSecurityAgency/ghidra","slug":"address-address-is-not-in-process-proc-7a1f67","errorCode":null,"errorMessage":"Address {address} is not in process {proc}","messagePattern":"Address (.+?) is not in process (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/arch.py","lineNumber":168,"sourceCode":"def compute_ghidra_lcsp() -> Tuple[str, str]:\n    lang = compute_ghidra_language()\n    comp = compute_ghidra_compiler(lang)\n    return lang, comp\n\n\nclass DefaultMemoryMapper(object):\n\n    def __init__(self, defaultSpace: str) -> None:\n        self.defaultSpace = defaultSpace\n\n    def map(self, proc: int, offset: int) -> Tuple[str, Address]:\n        space = self.defaultSpace\n        return self.defaultSpace, Address(space, offset)\n\n    def map_back(self, proc: int, address: Address) -> int:\n        if address.space == self.defaultSpace:\n            return address.offset\n        raise ValueError(\n            f\"Address {address} is not in process {proc}\")\n\n\nDEFAULT_MEMORY_MAPPER = DefaultMemoryMapper('ram')\n\nmemory_mappers: Dict[str, DefaultMemoryMapper] = {}\n\n\ndef compute_memory_mapper(lang: str) -> DefaultMemoryMapper:\n    if not lang in memory_mappers:\n        return DEFAULT_MEMORY_MAPPER\n    return memory_mappers[lang]\n\n\nclass DefaultRegisterMapper(object):\n\n    def __init__(self, byte_order: str) -> None:\n        if not byte_order in ['big', 'little']:","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/arch.py#L150-L186","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Register a language-specific mapper in arch.memory_mappers that handles the target's address spaces.","Ensure the Address passed to map_back() was produced by the matching map() call (same space).","Check address.space == mapper.defaultSpace before invoking map_back()."],"exampleFix":"// before\noffset = mapper.map_back(proc, address)  # address.space != 'ram'\n// after\nif address.space != mapper.defaultSpace:\n    raise ValueError(f\"{address} not in space {mapper.defaultSpace}\")\noffset = mapper.map_back(proc, address)","handlingStrategy":"validation","validationCode":"mapper = arch.compute_memory_mapper(lang)\nif address.space != mapper.defaultSpace:\n    raise ValueError(f'{address} not in default space {mapper.defaultSpace}')\noffset = mapper.map_back(proc, address)","typeGuard":"def address_in_space(address, mapper) -> bool:\n    return getattr(address, 'space', None) == mapper.defaultSpace","tryCatchPattern":"try:\n    offset = mapper.map_back(proc, address)\nexcept ValueError as e:\n    log.warning('cannot map address %s back: %s', address, e)\n    return None","preventionTips":["Register a language-specific mapper in arch.memory_mappers for multi-space targets.","Only feed addresses produced by the matching map() call back into map_back().","Check address.space against mapper.defaultSpace before translating."],"tags":["drgn","memory-mapper","address-space","valueerror"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}