NationalSecurityAgency/ghidra · error · IllegalArgumentException

Given platform does not belong to this trace

Error message

Given platform does not belong to this trace

What it means

assertMine validates that a TracePlatform belongs to this trace's platform manager. This variant fires when platform is neither the host platform nor an instance of DBTraceGuestPlatform (e.g. a mock or a platform from a different trace implementation). IllegalArgumentException("Given platform does not belong to this trace").

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTracePlatformManager.java:376

			}
			platform = doAddGuestPlatform(compilerSpec);
		}
		trace.setChanged(new TraceChangeRecord<>(TraceEvents.PLATFORM_ADDED, null, platform));
		return platform;
	}

	@Override
	public Collection<TraceGuestPlatform> getGuestPlatforms() {
		return platformView;
	}

	@Internal
	public InternalTracePlatform assertMine(TracePlatform platform) {
		if (platform == hostPlatform) {
			return hostPlatform;
		}
		if (!(platform instanceof DBTraceGuestPlatform)) {
			throw new IllegalArgumentException("Given platform does not belong to this trace");
		}
		DBTraceGuestPlatform dbPlatform = (DBTraceGuestPlatform) platform;
		if (dbPlatform.manager != this) {
			throw new IllegalArgumentException("Given platform does not belong to this trace");
		}
		if (dbPlatform.isDeleted()) {
			throw new IllegalArgumentException("Given platform has been deleted");
		}
		return dbPlatform;
	}

	protected Address computeNextRegisterMin() {
		AddressRange hostRegsRange = hostPlatform.getRegistersRange();
		Address next = hostRegsRange == null
				? hostPlatform.getAddressFactory().getRegisterSpace().getAddress(0)
				: hostRegsRange.getMaxAddress().add(1);
		for (DBTraceGuestPlatform guest : platformStore.asMap().values()) {
			Address candidateNext = guest.computeNextRegisterMin();

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Obtain platforms only from the same trace's getPlatform / getGuestPlatforms.
  2. Verify platform instanceof DBTraceGuestPlatform (or is the host) before passing.
  3. Do not share platform objects across traces; re-fetch per trace.

Example fix

// before
mgr.someOp(platformFromOtherTrace);

// after
if (!(platform instanceof DBTraceGuestPlatform) && platform != mgr.getHostPlatform()) {
    throw new IllegalArgumentException("foreign platform");
}
mgr.someOp(platform);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(platform instanceof DBTraceGuestPlatform) && platform != mgr.getHostPlatform()) {
    // foreign/non-DB platform; do not pass to this manager
}

Type guard

static boolean isMinePlatform(DBTracePlatformManager mgr, TracePlatform p) {
    return p == mgr.getHostPlatform() || p instanceof DBTraceGuestPlatform;
}

Prevention

When it happens

Trigger: Passing a platform obtained from a different DBTrace, a mock platform used in tests, or any non-DBTraceGuestPlatform into an API that internally calls assertMine.

Common situations: Multi-trace tooling mixing platform references; stale references after reopening a trace; test code using fake platform objects against real manager APIs.

Related errors


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