{"record":{"id":"70b1ce2f5e21b187","repo":"NationalSecurityAgency/ghidra","slug":"unsupported-p-code-op-at","errorCode":null,"errorMessage":"Unsupported p-code op at {}: {}","messagePattern":"Unsupported p-code op at (.+?): (.+?)","errorType":"exception","errorClass":"LowlevelError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/ProposedUtils/src/main/java/ghidra/pcode/eval/AbstractVarnodeEvaluator.java","lineNumber":428,"sourceCode":"\t\t\tdefault:\n\t\t\t\treturn badOp(op);\n\t\t}\n\t}\n\n\t/**\n\t * The method invoked when an unrecognized or unsupported operator is encountered\n\t * \n\t * @param op the op\n\t * @return the value, but this usually throws an exception\n\t */\n\tprotected T badOp(PcodeOp op) {\n\t\tswitch (op.getOpcode()) {\n\t\t\tcase PcodeOp.UNIMPLEMENTED:\n\t\t\t\tthrow new LowlevelError(\n\t\t\t\t\t\"Encountered an unimplemented instruction at \" +\n\t\t\t\t\t\top.getSeqnum().getTarget());\n\t\t\tdefault:\n\t\t\t\tthrow new LowlevelError(\n\t\t\t\t\t\"Unsupported p-code op at \" + op.getSeqnum().getTarget() + \": \" + op);\n\t\t}\n\t}\n}\n","sourceCodeStart":410,"sourceCodeEnd":433,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/pcode/eval/AbstractVarnodeEvaluator.java#L410-L433","documentation":"Thrown (unchecked LowlevelError) by badOp() as the default case: the op's opcode is neither UNIMPLEMENTED nor one the evaluator's evaluateOp dispatch handles. Unlike the UNIMPLEMENTED case, this is an opcode the emulator simply doesn't support (e.g. exotic p-code ops not yet wired into the evaluator switch).","triggerScenarios":"Driving AbstractVarnodeEvaluator (or a subclass) over p-code whose opcode has no case in evaluateOp, so it falls through to badOp's default. Occurs with newer/rarer p-code ops (e.g. newly added ops, or ops your subclass didn't override) on standard instructions.","commonSituations":"A new Ghidra version adds p-code ops your evaluator subclass doesn't handle; analyzing code that exercises p-code ops (like MULTIEQUAL, INDIRECT, certain CALLOTHER ops) not covered by your override; partial evaluator implementation.","solutions":["Override evaluateOp in your subclass to add cases for the missing opcode(s) named in the message.","Inspect op.getOpcode() for the failing op and implement/redirect its handling (often return the value of the relevant input or a symbolic result).","Catch LowlevelError and degrade gracefully for unsupported ops if full coverage isn't required.","Track the Ghidra version's PcodeOp constants so newly added opcodes get handlers."],"exampleFix":"// before: default badOp throws on unhandled opcode\nT out = evaluator.evaluateOp(program, op, cache);\n\n// after: add the missing case in your subclass's evaluateOp\n@Override\nprotected T evaluateOp(Program p, PcodeOp op, Map<Varnode,T> cache) {\n    switch (op.getOpcode()) {\n        case PcodeOp.MULTIEQUAL:\n            return evaluateVarnode(p, op.getInput(0), cache);\n        default:\n            return super.evaluateOp(p, op, cache);\n    }\n}","handlingStrategy":"try-catch","validationCode":"// Check opcode coverage before delegating to the base evaluator\nif (!isHandledByEvaluator(op.getOpcode())) {\n    // opcode has no case in evaluateOp -> badOp default; add a handler\n}","typeGuard":null,"tryCatchPattern":"try {\n    T out = evaluator.evaluateOp(program, op, cache);\n} catch (LowlevelError e) {\n    if (e.getMessage().startsWith(\"Unsupported p-code op\")) { /* add handler / degrade */ }\n    else throw e;\n}","preventionTips":["Override evaluateOp and add cases for every opcode your analysis may hit.","Track new PcodeOp constants when upgrading Ghidra versions.","Catch LowlevelError to degrade gracefully for unsupported ops."],"tags":["pcode","emulation","unsupported-op","lowlevel-error","unchecked-exception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}