{"record":{"id":"e02359fa498f1307","repo":"NationalSecurityAgency/ghidra","slug":"the-function-for-the-frame-is-no-longer-present-in","errorCode":null,"errorMessage":"The function for the frame is no longer present in the mapped program.","messagePattern":"The function for the frame is no longer present in the mapped program\\.","errorType":"exception","errorClass":"UnwindException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java","lineNumber":209,"sourceCode":"\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}\n\t\t\treturn ref.getToAddress();\n\t\t}\n\t\treturn null;\n\t}\n\n\t@Override\n\tpublic String getDescription() {\n\t\treturn frame.getComment(CommentType.PRE);","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java#L191-L227","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run auto-analysis on the mapped program so the FunctionManager creates a function at the mapped address.","Manually create a function at the static address using 'Create Function' in the Ghidra listing.","Re-establish the trace-to-program mapping if the program was re-imported (the old mapping is stale).","Check that the correct program version is open — close and reopen the program that matches the debug session."],"exampleFix":"// No code fix; the resolution is to ensure the static program has a function at the mapped PC address.\n// In Ghidra: navigate to the mapped address, then use Analysis > Auto Analyze or right-click > Create Function.","handlingStrategy":"validation","validationCode":"// Before calling unwinding, verify the function exists in the mapped program:\nProgramLocation staticLoc = mappingService.getOpenMappedLocation(traceLoc);\nif (staticLoc != null) {\n    Function fn = staticLoc.getProgram()\n        .getFunctionManager()\n        .getFunctionContaining(staticLoc.getAddress());\n    if (fn == null) {\n        // warn user or trigger auto-analysis before unwinding\n    }\n}","typeGuard":"// Check function availability before unwinding\nprivate boolean isFunctionAvailableForFrame(TraceLocation loc, DebugMappingService ms) {\n    ProgramLocation pl = ms.getOpenMappedLocation(loc);\n    if (pl == null) return false;\n    return pl.getProgram().getFunctionManager().getFunctionContaining(pl.getAddress()) != null;\n}","tryCatchPattern":"try {\n    // unwinding code that calls loadFunction()\n} catch (UnwindException e) {\n    if (e.getMessage().contains(\"no longer present\")) {\n        // trigger auto-analysis, then retry unwinding\n    } else { throw e; }\n}","preventionTips":["Run auto-analysis on the mapped program before starting debug sessions.","Avoid deleting functions from the static program during active debugging.","Keep the trace-to-program mapping synchronized with the current program state.","If re-importing a binary, re-establish all trace mappings."],"tags":["debugger","stack-unwinding","mapping","function-manager"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}