{"record":{"id":"31bcf9f2578b649c","repo":"NationalSecurityAgency/ghidra","slug":"this-is-meant-for-p-code-executor-use","errorCode":null,"errorMessage":"This is meant for p-code executor use","messagePattern":"This is meant for p-code executor use","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/data/DefaultPcodeTraceThreadAccess.java","lineNumber":105,"sourceCode":"\t@Override\n\tpublic int getBytes(Address start, ByteBuffer buf) {\n\t\tif (start.isRegisterAddress()) {\n\t\t\treturn registers.getBytes(start, buf);\n\t\t}\n\t\treturn memory.getBytes(start, buf);\n\t}\n\n\t@Override\n\tpublic Address translate(Address address) {\n\t\tif (address.isRegisterAddress()) {\n\t\t\treturn registers.translate(address);\n\t\t}\n\t\treturn memory.translate(address);\n\t}\n\n\t@Override\n\tpublic <T> PcodeTracePropertyAccess<T> getPropertyAccess(String name, Class<T> type) {\n\t\tthrow new UnsupportedOperationException(\"This is meant for p-code executor use\");\n\t}\n\n\t@Override\n\tpublic void initializeThreadContext(PcodeThread<?> thread) {\n\t\tregisters.initializeThreadContext(thread);\n\t}\n}\n","sourceCodeStart":87,"sourceCodeEnd":113,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/data/DefaultPcodeTraceThreadAccess.java#L87-L113","documentation":"DefaultPcodeTraceThreadAccess is a combined memory+register data-access shim intended only for stand-alone p-code executor use (e.g. Sleigh expression evaluation). It does not expose trace properties; getPropertyAccess always throws UnsupportedOperationException because property-based state pieces require the memory/register-level AbstractPcodeTraceDataAccess shim, not this thread-level wrapper.","triggerScenarios":"Calling getPropertyAccess(name, type) on a DefaultPcodeTraceThreadAccess instance — e.g. wiring a property p-code state piece (TraceEmulationIntegration property callbacks) against the thread access shim instead of the underlying memory/register data access.","commonSituations":"Building an emulator state that needs trace properties (e.g. to read/write a custom property during emulation) but using the thread-level data access shim. Mis-wiring property callbacks to the wrong access layer.","solutions":["Obtain property access from the memory/register-level PcodeTraceDataAccess (AbstractPcodeTraceDataAccess), not the DefaultPcodeTraceThreadAccess wrapper.","Do not attach property-based state pieces to this thread access shim; it is read-only-ish memory/register multiplexing for expression evaluation.","If you need properties during emulation, use the full TraceEmulationIntegration data-access path that supports getPropertyAccess."],"exampleFix":"// before: property access requested from the thread shim\nPcodeTracePropertyAccess<Long> pa = threadAccess.getPropertyAccess(\"myProp\", Long.class);\n\n// after: get it from the underlying memory/register data access\nPcodeTracePropertyAccess<Long> pa = memoryAccess.getPropertyAccess(\"myProp\", Long.class);","handlingStrategy":"validation","validationCode":"// Only request property access from the memory/register-level data access, not the thread shim.\nif (access instanceof DefaultPcodeTraceThreadAccess) {\n    throw new IllegalStateException(\n        \"Property access unavailable on thread-level shim; use the memory/register data access.\");\n}","typeGuard":"static boolean supportsPropertyAccess(PcodeTraceDataAccess access) {\n    return !(access instanceof DefaultPcodeTraceThreadAccess);\n}","tryCatchPattern":"try {\n    return access.getPropertyAccess(name, type);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"p-code executor use\")) {\n        // re-resolve access to the memory/register-level AbstractPcodeTraceDataAccess and retry\n    } else throw e;\n}","preventionTips":["Never wire property-based state pieces against DefaultPcodeTraceThreadAccess.","Use the full TraceEmulationIntegration data path when properties are required during emulation.","Treat the thread shim as memory/register-only for expression evaluation."],"tags":["pcode-executor","trace-data-access","property-access","unsupported-operation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}