NationalSecurityAgency/ghidra · error · LowlevelError

Encountered an unimplemented instruction at {}

Error message

Encountered an unimplemented instruction at {}

What it means

Thrown (unchecked LowlevelError) by badOp() when the p-code op's opcode is PcodeOp.UNIMPLEMENTED, meaning the underlying machine instruction is not implemented in the processor's SLEIGH language spec. The message includes the instruction's target address for diagnosis. This is a tooling/data limitation, not a logic bug in your code.

Source

Thrown at Ghidra/Debug/ProposedUtils/src/main/java/ghidra/pcode/eval/AbstractVarnodeEvaluator.java:424

			case PcodeOp.PTRADD:
				return evaluatePtrAdd(program, op, already);
			case PcodeOp.PTRSUB:
				return evaluatePtrSub(program, op, already);
			default:
				return badOp(op);
		}
	}

	/**
	 * The method invoked when an unrecognized or unsupported operator is encountered
	 * 
	 * @param op the op
	 * @return the value, but this usually throws an exception
	 */
	protected T badOp(PcodeOp op) {
		switch (op.getOpcode()) {
			case PcodeOp.UNIMPLEMENTED:
				throw new LowlevelError(
					"Encountered an unimplemented instruction at " +
						op.getSeqnum().getTarget());
			default:
				throw new LowlevelError(
					"Unsupported p-code op at " + op.getSeqnum().getTarget() + ": " + op);
		}
	}
}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Confirm the target processor language module supports the instruction; switch to a more complete SLEIGH spec if available.
  2. Catch LowlevelError around emulation of a region and skip/handle the unimplemented instruction (e.g. treat as no-op or unsupported block).
  3. If you maintain the language spec, add the missing p-code semantics for that instruction.
  4. Restrict analysis to instruction sequences known to be fully implemented.

Example fix

// before
T out = evaluator.evaluateOp(program, op, cache); // LowlevelError on UNIMPLEMENTED

// after: skip unimplemented instructions explicitly
if (op.getOpcode() == PcodeOp.UNIMPLEMENTED) {
    return unsupportedMarker(op);
}
T out = evaluator.evaluateOp(program, op, cache);
Defensive patterns

Strategy: try-catch

Validate before calling

// Skip UNIMPLEMENTED ops instead of evaluating them
if (op.getOpcode() == PcodeOp.UNIMPLEMENTED) {
    // instruction not modelled in the SLEIGH spec; skip or mark unsupported
}

Try / catch

try {
    T out = evaluator.evaluateOp(program, op, cache);
} catch (LowlevelError e) {
    if (e.getMessage().startsWith("Encountered an unimplemented instruction")) { /* skip region */ }
    else throw e;
}

Prevention

When it happens

Trigger: Evaluating p-code where an instruction translates to an UNIMPLEMENTED op because the SLEIGH specification for the target processor does not provide semantics for that instruction. Encountered when emulating or symbolically executing binaries for architectures with incomplete instruction coverage.

Common situations: Emulating code for an architecture whose p-code spec is partial; stepping into vendor-specific or privileged instructions the spec marks UNIMPLEMENTED; analyzing a binary that uses an instruction variant the language module doesn't model.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/38f465ccebffd6fa. Report an issue: GitHub.