NationalSecurityAgency/ghidra · error · IllegalArgumentException

Address does not belong to a memory in the trace

Error message

Address does not belong to a memory in the trace

What it means

Thrown by PlaceEmuBreakpointActionItem.findBreakpointContainer when no memory region contains the breakpoint address and no region exists anywhere in the address space for the given snap. Placing an emulated breakpoint requires an addressable memory region to anchor the breakpoint's container object.

Source

Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/PlaceEmuBreakpointActionItem.java:69

	private TraceMemoryRegion findRegion() {
		TraceMemoryRegion region = trace.getMemoryManager().getRegionContaining(snap, address);
		if (region != null) {
			return region;
		}
		AddressSpace space = address.getAddressSpace();
		Collection<? extends TraceMemoryRegion> regionsInSpace = trace.getMemoryManager()
				.getRegionsIntersecting(Lifespan.at(snap),
					new AddressRangeImpl(space.getMinAddress(), space.getMaxAddress()));
		if (!regionsInSpace.isEmpty()) {
			return regionsInSpace.iterator().next();
		}
		return null;
	}

	private TraceObject findBreakpointContainer() {
		TraceMemoryRegion region = findRegion();
		if (region == null) {
			throw new IllegalArgumentException("Address does not belong to a memory in the trace");
		}
		return region.getObject().findSuitableContainerInterface(TraceBreakpointSpec.class);
	}

	private String computePath() {
		String name = createName(address);
		TraceObject container = findBreakpointContainer();
		if (container == null) {
			throw new IllegalArgumentException(
				"Address is not associated with a breakpoint container");
		}
		PathFilter specFilter = container.getSchema().searchFor(TraceBreakpointSpec.class, true);
		if (specFilter == null) {
			throw new IllegalArgumentException("Cannot find path to breakpoint specifications");
		}
		KeyPath specRelPath = specFilter.applyKeys(name).getSingletonPath();
		if (specRelPath == null) {
			throw new IllegalArgumentException("Too many wildcards to breakpoint specification");

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Define a memory region covering the target address in the trace before placing the breakpoint.
  2. Select a snap at which the region containing the address exists.
  3. Verify trace.getMemoryManager().getRegionContaining(snap, address) is non-null before invoking the action.
  4. Place the breakpoint at an address inside an already-mapped region.

Example fix

// before
new PlaceEmuBreakpointActionItem(trace, snap, addr, len, kinds, sleigh).execute();
// throws if no region contains addr

// after
if (trace.getMemoryManager().getRegionContaining(snap, addr) == null) {
    try (Transaction tx = trace.openTransaction("Add region")) {
        trace.getMemoryManager().addRegion("Memory[ram]",
            Lifespan.nowOn(trace), new AddressRangeImpl(addr, len), ...
        );
    }
}
new PlaceEmuBreakpointActionItem(trace, snap, addr, len, kinds, sleigh).execute();
Defensive patterns

Strategy: validation

Validate before calling

boolean inMemory = trace.getMemoryManager().getRegionContaining(snap, address) != null;

Type guard

static boolean addressInMemory(Trace t, long snap, Address a) {
    return t.getMemoryManager().getRegionContaining(snap, a) != null;
}

Try / catch

try {
    item.execute();
} catch (IllegalArgumentException e) {
    Msg.showError(this, null, "Cannot place breakpoint", e.getMessage());
}

Prevention

When it happens

Trigger: Executing PlaceEmuBreakpointActionItem at an address with no containing TraceMemoryRegion and no region in the same AddressSpace at the target snap.

Common situations: Placing an emu breakpoint at an address outside any mapped region (e.g., in unmapped RAM/flash); doing so before memory regions are defined for the trace; wrong snap chosen before regions were created.

Related errors


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