NationalSecurityAgency/ghidra · error · UnwindException

The function for the frame is no longer present in the mappe

Error message

The function for the frame is no longer present in the mapped program.

What it means

Thrown during stack unwinding when the dynamic program counter is successfully mapped to a static program location, but no Function object exists at that address in the mapped program's FunctionManager. This UnwindException indicates the trace-to-program mapping resolves, but the static analysis state (function definitions) is stale or incomplete — the function that was present when the frame was created has since been removed or never committed.

Source

Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java:209

			return null;
		}
		return location.getByteAddress();
	}

	private Function loadFunction() {
		ProgramLocation staticLoc =
			mappingService.getOpenMappedLocation(new DefaultTraceLocation(frame.getTrace(), null,
				Lifespan.at(coordinates.getSnap()), pcVal));
		if (staticLoc == null) {
			throw new UnwindException(
				"The program containing the frame's function is unavailable," +
					" or the mappings have changed.");
		}
		Function function = staticLoc.getProgram()
				.getFunctionManager()
				.getFunctionContaining(staticLoc.getAddress());
		if (function == null) {
			throw new UnwindException(
				"The function for the frame is no longer present in the mapped program.");
		}
		return function;
	}

	private Address loadBasePointer() {
		for (TraceReference ref : frame.getOperandReferences(StackUnwinder.BASE_OP_INDEX)) {
			if (ref.getReferenceType() != RefType.DATA) {
				continue;
			}
			return ref.getToAddress();
		}
		return null;
	}

	@Override
	public String getDescription() {
		return frame.getComment(CommentType.PRE);

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Run auto-analysis on the mapped program so the FunctionManager creates a function at the mapped address.
  2. Manually create a function at the static address using 'Create Function' in the Ghidra listing.
  3. Re-establish the trace-to-program mapping if the program was re-imported (the old mapping is stale).
  4. Check that the correct program version is open — close and reopen the program that matches the debug session.

Example fix

// No code fix; the resolution is to ensure the static program has a function at the mapped PC address.
// In Ghidra: navigate to the mapped address, then use Analysis > Auto Analyze or right-click > Create Function.
Defensive patterns

Strategy: validation

Validate before calling

// Before calling unwinding, verify the function exists in the mapped program:
ProgramLocation staticLoc = mappingService.getOpenMappedLocation(traceLoc);
if (staticLoc != null) {
    Function fn = staticLoc.getProgram()
        .getFunctionManager()
        .getFunctionContaining(staticLoc.getAddress());
    if (fn == null) {
        // warn user or trigger auto-analysis before unwinding
    }
}

Type guard

// Check function availability before unwinding
private boolean isFunctionAvailableForFrame(TraceLocation loc, DebugMappingService ms) {
    ProgramLocation pl = ms.getOpenMappedLocation(loc);
    if (pl == null) return false;
    return pl.getProgram().getFunctionManager().getFunctionContaining(pl.getAddress()) != null;
}

Try / catch

try {
    // unwinding code that calls loadFunction()
} catch (UnwindException e) {
    if (e.getMessage().contains("no longer present")) {
        // trigger auto-analysis, then retry unwinding
    } else { throw e; }
}

Prevention

When it happens

Trigger: ListingUnwoundFrame.loadFunction() calls mappingService.getOpenMappedLocation() which returns a valid ProgramLocation, but staticLoc.getProgram().getFunctionManager().getFunctionContaining(staticLoc.getAddress()) returns null. Occurs when the user deletes or re-analyzes a function in the static program while a debug session trace still references it, or when the program was never auto-analyzed to create function definitions at the mapped address.

Common situations: The developer re-imported or re-analyzed the binary, clearing old function definitions. The program mapping points to an address range that Ghidra hasn't yet recognized as a function (no auto-analysis run). The user manually deleted a function from the listing. A version mismatch between the trace and the program database.

Related errors


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