{"record":{"id":"682aa1834f7b9e5c","repo":"NationalSecurityAgency/ghidra","slug":"the-program-containing-the-frame-s-function-is-una","errorCode":null,"errorMessage":"The program containing the frame's function is unavailable, or the mappings have changed.","messagePattern":"The program containing the frame's function is unavailable, or the mappings have changed\\.","errorType":"exception","errorClass":"UnwindException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java","lineNumber":201,"sourceCode":"\t\t}\n\t\tthrow new UnwindException(\"The program counter reference is missing for the frame!\");\n\t}\n\n\tprivate Address mapProgramCounter() {\n\t\tProgramLocation location = mappingService.getOpenMappedLocation(\n\t\t\tnew DefaultTraceLocation(trace, null, Lifespan.at(snap), pcVal));\n\t\tif (location.getProgram() != function.getProgram()) {\n\t\t\treturn null;\n\t\t}\n\t\treturn location.getByteAddress();\n\t}\n\n\tprivate Function loadFunction() {\n\t\tProgramLocation staticLoc =\n\t\t\tmappingService.getOpenMappedLocation(new DefaultTraceLocation(frame.getTrace(), null,\n\t\t\t\tLifespan.at(coordinates.getSnap()), pcVal));\n\t\tif (staticLoc == null) {\n\t\t\tthrow new UnwindException(\n\t\t\t\t\"The program containing the frame's function is unavailable,\" +\n\t\t\t\t\t\" or the mappings have changed.\");\n\t\t}\n\t\tFunction function = staticLoc.getProgram()\n\t\t\t\t.getFunctionManager()\n\t\t\t\t.getFunctionContaining(staticLoc.getAddress());\n\t\tif (function == null) {\n\t\t\tthrow new UnwindException(\n\t\t\t\t\"The function for the frame is no longer present in the mapped program.\");\n\t\t}\n\t\treturn function;\n\t}\n\n\tprivate Address loadBasePointer() {\n\t\tfor (TraceReference ref : frame.getOperandReferences(StackUnwinder.BASE_OP_INDEX)) {\n\t\t\tif (ref.getReferenceType() != RefType.DATA) {\n\t\t\t\tcontinue;\n\t\t\t}","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java#L183-L219","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the static program that the frame's PC maps to, then re-attempt unwinding.","Re-establish/refresh the static-to-dynamic mapping for the frame's PC address.","Catch UnwindException and skip the frame, prompting the user to fix mappings.","Re-annotate the stack frame after mappings are corrected."],"exampleFix":"// before\nFunction f = frame.loadFunction(); // throws: mapping missing/program closed\n\n// after\ntry {\n    Function f = frame.loadFunction();\n} catch (UnwindException e) {\n    Msg.warn(this, \"Frame function unavailable: \" + e.getMessage()\n        + \"; open the mapped program / refresh mappings\");\n    return null;\n}","handlingStrategy":"try-catch","validationCode":"// Confirm an open static mapping exists for the frame PC before unwinding\nProgramLocation staticLoc = mappingService.getOpenMappedLocation(\n    new DefaultTraceLocation(trace, null, Lifespan.at(snap), pcVal));\nif (staticLoc == null) {\n    // open the mapped program / re-establish mappings before unwinding\n}","typeGuard":"public static boolean frameMappingAvailable(\n        DebuggerStaticMappingService ms, Trace trace, long snap, Address pcVal) {\n    return ms.getOpenMappedLocation(\n        new DefaultTraceLocation(trace, null, Lifespan.at(snap), pcVal)) != null;\n}","tryCatchPattern":"try {\n    Function f = frame.loadFunction();\n} catch (UnwindException e) {\n    if (e.getMessage().contains(\"function is unavailable\")) {\n        // open the mapped program / refresh mappings, then retry\n    } else throw e;\n}","preventionTips":["Keep the static program mapped to a frame's PC open while unwinding.","Refresh static-to-dynamic mappings after program/trace edits before unwinding frames.","Re-annotate stack frames once mappings are corrected."],"tags":["stack-unwinding","static-mapping","lifecycle","program-manager"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}