{"record":{"id":"be28550aaa0e0cdb","repo":"NationalSecurityAgency/ghidra","slug":"guest-address-guestaddress-is-not-mapped","errorCode":null,"errorMessage":"Guest address {guestAddress} is not mapped","messagePattern":"Guest address (.+?) is not mapped","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/control/ControlMode.java","lineNumber":232,"sourceCode":"\t\tpublic boolean canEdit(DebuggerCoordinates coordinates) {\n\t\t\treturn coordinates.getTrace() != null;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean isVariableEditable(DebuggerCoordinates coordinates, Address address,\n\t\t\t\tint length) {\n\t\t\treturn address.isMemoryAddress() || coordinates.getThread() != null;\n\t\t}\n\n\t\t@Override\n\t\tpublic CompletableFuture<Void> setVariable(PluginTool tool,\n\t\t\t\tDebuggerCoordinates coordinates, Address guestAddress, byte[] data) {\n\t\t\tTrace trace = coordinates.getTrace();\n\t\t\tTracePlatform platform = platformFor(coordinates, guestAddress);\n\t\t\tlong snap = coordinates.getViewSnap();\n\t\t\tAddress hostAddress = platform.mapGuestToHost(guestAddress);\n\t\t\tif (hostAddress == null) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Guest address \" + guestAddress + \" is not mapped\");\n\t\t\t}\n\t\t\tTraceMemoryOperations memOrRegs;\n\t\t\tAddress overlayAddress;\n\t\t\ttry (Transaction tx = trace.openTransaction(\"Edit Variable\")) {\n\t\t\t\tif (hostAddress.isRegisterAddress()) {\n\t\t\t\t\tTraceThread thread = coordinates.getThread();\n\t\t\t\t\tif (thread == null) {\n\t\t\t\t\t\tthrow new IllegalArgumentException(\"Register edits require a thread.\");\n\t\t\t\t\t}\n\t\t\t\t\tTraceMemorySpace regs = trace.getMemoryManager()\n\t\t\t\t\t\t\t.getMemoryRegisterSpace(thread, coordinates.getFrame(),\n\t\t\t\t\t\t\t\ttrue);\n\t\t\t\t\tmemOrRegs = regs;\n\t\t\t\t\toverlayAddress = regs.getAddressSpace().getOverlayAddress(hostAddress);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tmemOrRegs = trace.getMemoryManager();","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/control/ControlMode.java#L214-L250","documentation":"Thrown as IllegalArgumentException by RW_TRACE.setVariable (ControlMode.java:230-234) when TracePlatform.mapGuestToHost(guestAddress) returns null. In RW_TRACE (Control Trace) mode, variable edits are written to the live trace snapshot; a guest address with no host-side mapping cannot be located, so the edit is rejected before opening the transaction.","triggerScenarios":"Calling setVariable on ControlMode.RW_TRACE with a guestAddress that the platform cannot translate (mapGuestToHost == null): an address in an unmapped overlay, a guest address for a platform with no address mapping configured, or an address space not present in the current platform.","commonSituations":"Multi-platform traces where the active platform lacks a mapping for the given guest space; editing before memory regions are recorded/mapped; a stale trace where mappings were not refreshed after a module load.","solutions":["Confirm the guest address is mapped for the active platform: check platform.mapGuestToHost(addr) != null before editing.","Record/refresh memory regions so the mapping exists, then retry the edit.","Switch to a platform whose mapping covers the address, or edit the equivalent host address directly."],"exampleFix":"// before\nRW_TRACE.setVariable(tool, coordinates, guestAddress, data);  // mapGuestToHost == null\n\n// after\nAddress host = platform.mapGuestToHost(guestAddress);\nif (host == null) {\n    throw new IllegalStateException(\"no mapping for \" + guestAddress);\n}\nRW_TRACE.setVariable(tool, coordinates, guestAddress, data);","handlingStrategy":"validation","validationCode":"Address host = platform.mapGuestToHost(guestAddress);\nif (host == null) {\n    throw new IllegalStateException(\"no host mapping for \" + guestAddress);\n}","typeGuard":"boolean isMapped(TracePlatform platform, Address guestAddress) {\n    return platform.mapGuestToHost(guestAddress) != null;\n}","tryCatchPattern":"try {\n    mode.setVariable(tool, coordinates, guestAddress, data);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"is not mapped\")) {\n        // refresh mappings or switch platform, then retry\n    } else throw e;\n}","preventionTips":["Check mapGuestToHost != null before editing in RW_TRACE mode.","Refresh/record memory regions so mappings exist.","Edit the equivalent host address when the guest space is unmapped."],"tags":["control-mode","address-mapping","trace","java"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}