NationalSecurityAgency/ghidra · error · UnsupportedOperationException

This is meant for p-code executor use

Error message

This is meant for p-code executor use

What it means

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.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/data/DefaultPcodeTraceThreadAccess.java:105

	@Override
	public int getBytes(Address start, ByteBuffer buf) {
		if (start.isRegisterAddress()) {
			return registers.getBytes(start, buf);
		}
		return memory.getBytes(start, buf);
	}

	@Override
	public Address translate(Address address) {
		if (address.isRegisterAddress()) {
			return registers.translate(address);
		}
		return memory.translate(address);
	}

	@Override
	public <T> PcodeTracePropertyAccess<T> getPropertyAccess(String name, Class<T> type) {
		throw new UnsupportedOperationException("This is meant for p-code executor use");
	}

	@Override
	public void initializeThreadContext(PcodeThread<?> thread) {
		registers.initializeThreadContext(thread);
	}
}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Obtain property access from the memory/register-level PcodeTraceDataAccess (AbstractPcodeTraceDataAccess), not the DefaultPcodeTraceThreadAccess wrapper.
  2. Do not attach property-based state pieces to this thread access shim; it is read-only-ish memory/register multiplexing for expression evaluation.
  3. If you need properties during emulation, use the full TraceEmulationIntegration data-access path that supports getPropertyAccess.

Example fix

// before: property access requested from the thread shim
PcodeTracePropertyAccess<Long> pa = threadAccess.getPropertyAccess("myProp", Long.class);

// after: get it from the underlying memory/register data access
PcodeTracePropertyAccess<Long> pa = memoryAccess.getPropertyAccess("myProp", Long.class);
Defensive patterns

Strategy: validation

Validate before calling

// Only request property access from the memory/register-level data access, not the thread shim.
if (access instanceof DefaultPcodeTraceThreadAccess) {
    throw new IllegalStateException(
        "Property access unavailable on thread-level shim; use the memory/register data access.");
}

Type guard

static boolean supportsPropertyAccess(PcodeTraceDataAccess access) {
    return !(access instanceof DefaultPcodeTraceThreadAccess);
}

Try / catch

try {
    return access.getPropertyAccess(name, type);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("p-code executor use")) {
        // re-resolve access to the memory/register-level AbstractPcodeTraceDataAccess and retry
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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