NationalSecurityAgency/ghidra · error · UnwindException

The program containing the frame's function is unavailable,

Error message

The program containing the frame's function is unavailable, or the mappings have changed.

What it means

ListingUnwoundFrame.loadFunction() resolves the static program+function containing the frame's PC by calling getOpenMappedLocation on a DefaultTraceLocation at the PC address. If that returns null — no static mapping is open for the PC, or the mapped program is not available — it throws UnwindException("The program containing the frame's function is unavailable, or the mappings have changed."). The unwinder needs the mapped static function to interpret the frame.

Source

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

		}
		throw new UnwindException("The program counter reference is missing for the frame!");
	}

	private Address mapProgramCounter() {
		ProgramLocation location = mappingService.getOpenMappedLocation(
			new DefaultTraceLocation(trace, null, Lifespan.at(snap), pcVal));
		if (location.getProgram() != function.getProgram()) {
			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;
			}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Open the static program that the frame's PC maps to, then re-attempt unwinding.
  2. Re-establish/refresh the static-to-dynamic mapping for the frame's PC address.
  3. Catch UnwindException and skip the frame, prompting the user to fix mappings.
  4. Re-annotate the stack frame after mappings are corrected.

Example fix

// before
Function f = frame.loadFunction(); // throws: mapping missing/program closed

// after
try {
    Function f = frame.loadFunction();
} catch (UnwindException e) {
    Msg.warn(this, "Frame function unavailable: " + e.getMessage()
        + "; open the mapped program / refresh mappings");
    return null;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm an open static mapping exists for the frame PC before unwinding
ProgramLocation staticLoc = mappingService.getOpenMappedLocation(
    new DefaultTraceLocation(trace, null, Lifespan.at(snap), pcVal));
if (staticLoc == null) {
    // open the mapped program / re-establish mappings before unwinding
}

Type guard

public static boolean frameMappingAvailable(
        DebuggerStaticMappingService ms, Trace trace, long snap, Address pcVal) {
    return ms.getOpenMappedLocation(
        new DefaultTraceLocation(trace, null, Lifespan.at(snap), pcVal)) != null;
}

Try / catch

try {
    Function f = frame.loadFunction();
} catch (UnwindException e) {
    if (e.getMessage().contains("function is unavailable")) {
        // open the mapped program / refresh mappings, then retry
    } else throw e;
}

Prevention

When it happens

Trigger: Unwinding a listing frame when the static program mapped to the trace PC is not open, or the static-to-dynamic mapping was deleted/changed. Frame created under one mapping then mappings edited. Program closed or renamed after the frame was created.

Common situations: User closes the static program that the frame maps to. Re-importing/re-mapping modules invalidates prior frame mappings. Stale frame annotations after mapping edits.

Related errors


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