{"record":{"id":"889e942466b7c0a3","repo":"NationalSecurityAgency/ghidra","slug":"this-mapper-cannot-handle-harvard-guests","errorCode":null,"errorMessage":"This mapper cannot handle Harvard guests","messagePattern":"This mapper cannot handle Harvard guests","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/mapping/DefaultDebuggerPlatformMapper.java","lineNumber":47,"sourceCode":"public class DefaultDebuggerPlatformMapper extends AbstractDebuggerPlatformMapper {\n\n\tprotected static boolean isHarvard(Language language) {\n\t\treturn language.getDefaultSpace() != language.getDefaultDataSpace();\n\t}\n\n\tprotected final PluginTool tool;\n\tprotected final CompilerSpec cSpec;\n\n\tpublic DefaultDebuggerPlatformMapper(PluginTool tool, Trace trace, CompilerSpec cSpec) {\n\t\tsuper(tool, trace);\n\t\tvalidate(cSpec);\n\t\tthis.tool = tool;\n\t\tthis.cSpec = cSpec;\n\t}\n\n\tprotected void validate(CompilerSpec cSpec) {\n\t\tif (isHarvard(cSpec.getLanguage())) {\n\t\t\tthrow new IllegalArgumentException(\"This mapper cannot handle Harvard guests\");\n\t\t}\n\t}\n\n\t@Override\n\tpublic CompilerSpec getCompilerSpec(TraceObject object, long snap) {\n\t\treturn cSpec;\n\t}\n\n\tprotected TracePlatform addOrGetPlatform(CompilerSpec cSpec, long snap) {\n\t\tString description = \"Add guest \" + cSpec.getLanguage().getLanguageDescription() + \"/\" +\n\t\t\tcSpec.getCompilerSpecDescription();\n\t\ttry (Transaction tx = trace.openTransaction(description)) {\n\t\t\tTracePlatformManager platformManager = trace.getPlatformManager();\n\t\t\tTracePlatform platform = platformManager.getOrAddPlatform(cSpec);\n\t\t\tif (!platform.isHost()) {\n\t\t\t\taddMappedRanges((TraceGuestPlatform) platform);\n\t\t\t}\n\t\t\treturn platform;","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/mapping/DefaultDebuggerPlatformMapper.java#L29-L65","documentation":"Thrown by DefaultDebuggerPlatformMapper.validate when the target language is a Harvard architecture (separate instruction and data address spaces). The default mapper assumes a von Neumann (unified) memory model and cannot reconcile split code/data spaces.","triggerScenarios":"Constructing a DefaultDebuggerPlatformMapper (or a mapper whose validate calls super) for a CompilerSpec whose Language is Harvard (isHarvard(language) returns true), e.g., AVR, 8051, PIC.","commonSituations":"Debugging an embedded Harvard-architecture target (AVR, 8051, PIC, MSP430 variants) with the default platform mapper instead of a Harvard-aware one; misconfigured platform mapping for such targets.","solutions":["Use a Harvard-capable platform mapper subclass for the target architecture.","Confirm the selected processor module/compiler spec is correct for the target; switch to the appropriate mapper via the platform mapping UI.","If you are extending the mapper, override validate() to handle split address spaces instead of rejecting them.","Report/extend mapping support for the specific Harvard target upstream."],"exampleFix":"// before\nnew DefaultDebuggerPlatformMapper(tool, trace, cSpec); // throws for Harvard lang\n\n// after\nif (isHarvard(cSpec.getLanguage())) {\n    mapper = new HarvardDebuggerPlatformMapper(tool, trace, cSpec);\n} else {\n    mapper = new DefaultDebuggerPlatformMapper(tool, trace, cSpec);\n}","handlingStrategy":"type-guard","validationCode":"boolean defaultOk = !isHarvard(cSpec.getLanguage());","typeGuard":"static boolean isHarvardLang(Language l) {\n    // mirrors DefaultDebuggerPlatformMapper.isHarvard\n    return l != null && l.getAddressFactory().getInstructionSpace() != null\n        && l.getAddressFactory().getAddressSpaces().length > 1; // illustrative\n}","tryCatchPattern":"try {\n    new DefaultDebuggerPlatformMapper(tool, trace, cSpec);\n} catch (IllegalArgumentException e) {\n    // select a Harvard-aware mapper instead\n}","preventionTips":["Detect Harvard targets and choose the matching mapper.","Do not apply the default mapper to split code/data architectures."],"tags":["mapping","harvard","architecture","platform","von-neumann"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}