{"record":{"id":"20a43b53292a758b","repo":"NationalSecurityAgency/ghidra","slug":"address-address-is-not-in-process-proc","errorCode":null,"errorMessage":"Address {address} is not in process {proc}","messagePattern":"Address (.+?) is not in process (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py","lineNumber":220,"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(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']:\n            raise ValueError(\"Invalid byte_order: {}\".format(byte_order))","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py#L202-L238","documentation":"Thrown by DefaultMemoryMapper.map_back() when the Address object's space does not match the mapper's defaultSpace. During reverse-mapping (from Ghidra address space back to debugger offset), the address belongs to a different address space than expected, so the offset cannot be extracted. This ValueError signals an address-space mismatch in the debugger bridge.","triggerScenarios":"DefaultMemoryMapper.map_back(proc, address) checks address.space == self.defaultSpace; if they differ, ValueError is raised. The default mapper is initialized with 'ram' as the space, so any address in a different space (e.g., 'register', 'stack', a segment space) triggers the error. Called when the debugger bridge tries to translate a Ghidra-space address back to a debugger offset.","commonSituations":"The target architecture uses multiple address spaces (e.g., Harvard architecture with separate code/data spaces). The memory mapper wasn't configured for the correct language — the default 'ram' mapper is used when no architecture-specific mapper is registered in memory_mappers. An address from the register space or a custom space is passed to the memory mapper.","solutions":["Register a custom memory mapper for the target language in the memory_mappers dictionary that handles the correct spaces.","Ensure addresses passed to map_back are from the expected address space.","Check that compute_memory_mapper(lang) returns the right mapper for the target architecture.","If the architecture needs multi-space support, subclass DefaultMemoryMapper and override map_back."],"exampleFix":"# Before: default mapper only handles 'ram' space\n# arch.memory_mappers['x86:LE:64:default'] = MyMultiSpaceMapper(['ram', 'code'])\n#\n# class MyMultiSpaceMapper(arch.DefaultMemoryMapper):\n#     def map_back(self, proc, address):\n#         if address.space in self.valid_spaces:\n#             return address.offset\n#         raise ValueError(f\"Address {address} not in known spaces\")","handlingStrategy":"validation","validationCode":"# Before calling map_back, check the address space:\nif address.space == mapper.defaultSpace:\n    offset = mapper.map_back(proc, address)\nelse:\n    # handle alternative space or use correct mapper","typeGuard":"# Check if address is in the mapper's space before reverse-mapping\ndef is_in_default_space(address: Address, mapper: DefaultMemoryMapper) -> bool:\n    return address.space == mapper.defaultSpace","tryCatchPattern":"try:\n    offset = mapper.map_back(proc, address)\nexcept ValueError as e:\n    if 'is not in process' in str(e):\n        # address is in a different space; handle or use space-specific mapper\n    else:\n        raise","preventionTips":["Register architecture-specific memory mappers in arch.memory_mappers for multi-space targets.","Validate address.space against the mapper's defaultSpace before calling map_back.","Understand the target architecture's address space model before debugging.","Use the correct mapper returned by compute_memory_mapper(lang) for each language."],"tags":["debugger-agent","memory-mapping","address-space","python","dbgeng"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}