{"record":{"id":"8f06eb1e9f10aa1c","repo":"NationalSecurityAgency/ghidra","slug":"register-register-is-not-mapped","errorCode":null,"errorMessage":"Register {register} is not mapped","messagePattern":"Register (.+?) is not mapped","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/InternalTracePlatform.java","lineNumber":62,"sourceCode":"\t/**\n\t * Get the entry's key in the table as an integer\n\t * \n\t * @return the key\n\t */\n\tint getIntKey();\n\n\tDBTraceGuestLanguage getLanguageEntry();\n\n\t@Override\n\tdefault AddressFactory getAddressFactory() {\n\t\treturn TracePlatform.super.getAddressFactory();\n\t}\n\n\t@Override\n\tdefault AddressRange getConventionalRegisterRange(AddressSpace space, Register register) {\n\t\tAddressRange result = mapGuestToHost(TraceRegisterUtils.rangeForRegister(register));\n\t\tif (result == null) {\n\t\t\tthrow new IllegalArgumentException(\"Register \" + register + \" is not mapped\");\n\t\t}\n\t\tif (space == null) {\n\t\t\treturn result;\n\t\t}\n\t\tif (register.getAddressSpace().isRegisterSpace()) {\n\t\t\tif (result.getAddressSpace() != space.getPhysicalSpace()) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Register \" + register + \" does not map to space \" + space +\n\t\t\t\t\t\t\"'s physical space (\" + space.getPhysicalSpace() + \")\");\n\t\t\t}\n\t\t\treturn new AddressRangeImpl(\n\t\t\t\tspace.getOverlayAddress(result.getMinAddress()),\n\t\t\t\tspace.getOverlayAddress(result.getMaxAddress()));\n\t\t}\n\t\tif (result.getAddressSpace() != space) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Memory-mapped register \" + register + \" does not map to space \" + space);\n\t\t}","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/InternalTracePlatform.java#L44-L80","documentation":"getConventionalRegisterRange maps the register's address range from guest to host via mapGuestToHost(TraceRegisterUtils.rangeForRegister(register)); if the result is null it throws IllegalArgumentException(\"Register X is not mapped\"). The guest register's address has no host-side mapping covering it, so it cannot be translated.","triggerScenarios":"Calling getConventionalRegisterRange on a guest platform register before any addMappedRange covers the register bank; querying a register on a partially-mapped guest platform; newly-added guest platform without register mapping.","commonSituations":"Querying registers on a guest that hasn't had its register bank mapped to host memory; partial mappings covering some registers but not the queried one.","solutions":["Establish a register-bank mapping via addMappedRange over the register address range first.","Pre-check mapGuestToHost(register.getAddress()) != null before calling getConventionalRegisterRange.","Query a register known to be within an existing mapping."],"exampleFix":"// before\nAddressRange r = platform.getConventionalRegisterRange(space, reg);\n\n// after\nif (platform.mapGuestToHost(reg.getAddress()) == null) {\n    // ensure register bank is mapped first\n    platform.addMappedRange(hostBase, reg.getAddress(), reg.getNumBytes());\n}\nAddressRange r = platform.getConventionalRegisterRange(space, reg);","handlingStrategy":"validation","validationCode":"if (platform.mapGuestToHost(register.getAddress()) == null) {\n    // map the register bank (addMappedRange) before querying\n}","typeGuard":"static boolean registerIsMapped(InternalTracePlatform p, Register r) {\n    return p.mapGuestToHost(r.getAddress()) != null;\n}","tryCatchPattern":"try { return platform.getConventionalRegisterRange(space, register); }\ncatch (IllegalArgumentException e) { /* register not mapped; map it first */ }","preventionTips":["Map the guest register bank to host memory before any register query.","Pre-check mapGuestToHost(register.getAddress()) != null.","Ensure mappings cover the full register address range, not just part of it."],"tags":["register","mapping","guest"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}