{"record":{"id":"2aa7b3487a5f556b","repo":"NationalSecurityAgency/ghidra","slug":"cannot-find-static-program-for-frame-pc-pcval","errorCode":null,"errorMessage":"Cannot find static program for frame  ({pc}={pcVal})","messagePattern":"Cannot find static program for frame  \\((.+?)=(.+?)\\)","errorType":"exception","errorClass":"UnwindException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/StackUnwinder.java","lineNumber":326,"sourceCode":"\t/**\n\t * Compute the unwind information for the given program counter and context\n\t * \n\t * <p>\n\t * For the most part, this just translates the dynamic program counter to a static program\n\t * address and then invokes {@link UnwindAnalysis#computeUnwindInfo(Address, TaskMonitor)}.\n\t * \n\t * @param snap the snapshot key (used for mapping the program counter to a program database)\n\t * @param pcVal the program counter (dynamic)\n\t * @param monitor a monitor for cancellation\n\t * @return the unwind info, possibly incomplete\n\t * @throws CancelledException if the monitor is cancelled\n\t */\n\tpublic StaticAndUnwind computeUnwindInfo(long snap, Address pcVal,\n\t\t\tTaskMonitor monitor) throws CancelledException {\n\t\t// TODO: Try markup in trace first?\n\t\tProgramLocation staticPcLoc = getProgramLocation(snap, pcVal);\n\t\tif (staticPcLoc == null) {\n\t\t\tthrow new UnwindException(\n\t\t\t\t\"Cannot find static program for frame  (\" + pc + \"=\" + pcVal + \")\");\n\t\t}\n\t\tProgram program = staticPcLoc.getProgram();\n\t\tAddress staticPc = staticPcLoc.getAddress();\n\t\ttry {\n\t\t\tUnwindInfo info = service.getUnwindInfo(program, staticPc, monitor);\n\t\t\tStaticAndUnwind sau = new StaticAndUnwind(staticPc, info);\n\t\t\tif (sau.info().ofReturn() == null) {\n\t\t\t\tFunction function = sau.info().function();\n\t\t\t\tif (function != null) {\n\t\t\t\t\tAddress ep = function.getEntryPoint();\n\t\t\t\t\tUnwindInfo epInfo = service.getUnwindInfo(program, ep, monitor);\n\t\t\t\t\tinfo = new UnwindInfo(info.function(), info.depth(),\n\t\t\t\t\t\tinfo.adjust(), epInfo.ofReturn(), epInfo.maskOfReturn(), info.saved(),\n\t\t\t\t\t\tinfo.warnings(), info.error());\n\t\t\t\t\tsau = new StaticAndUnwind(staticPc, info);\n\t\t\t\t}\n\t\t\t}","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/StackUnwinder.java#L308-L344","documentation":"Thrown during stack unwinding when the dynamic program counter value (pcVal) cannot be mapped to any open static program via getProgramLocation(). This UnwindException means there is no trace-to-program mapping that covers the given snapshot and address, so the unwinder cannot translate the live PC into a static address for analysis.","triggerScenarios":"StackUnwinder.computeUnwindInfo() calls getProgramLocation(snap, pcVal) which returns null. This happens when no mapping service entry covers the PC's address space at the given snapshot, when the target program is not open in the tool, or when the trace's memory regions were never mapped to a static program.","commonSituations":"The developer started debugging without opening the corresponding static program. The address space mapping was never set up between the trace and the program. The program was closed or the mapping was invalidated after a session reload. Debugging a region of memory (e.g., JIT code, dynamically loaded library) that has no corresponding static program.","solutions":["Open the static program that corresponds to the debug target in the Ghidra tool.","Configure or re-establish the trace-to-program mapping (Debugger > Mappings) to cover the PC's address range.","Verify the snapshot (snap) being used corresponds to a state where mappings are valid.","If debugging dynamically loaded code, map the module's memory region to its imported program."],"exampleFix":"// No code fix; ensure a valid mapping exists:\n// Debugger tool > Window > Mappings > add/verify mapping from trace space to static program.","handlingStrategy":"validation","validationCode":"// Check that a static program location can be found before computing unwind info:\nProgramLocation staticPcLoc = getProgramLocation(snap, pcVal);\nif (staticPcLoc == null) {\n    // inform user: no mapping for this PC; skip frame or set up mapping\n}","typeGuard":"private boolean hasStaticMapping(long snap, Address pcVal) {\n    return getProgramLocation(snap, pcVal) != null;\n}","tryCatchPattern":"try {\n    StaticAndUnwind sau = unwinder.computeUnwindInfo(snap, pcVal, monitor);\n} catch (UnwindException e) {\n    if (e.getMessage().startsWith(\"Cannot find static program\")) {\n        // mapping missing — prompt user to configure trace-to-program mapping\n    } else { throw e; }\n}","preventionTips":["Always open the static program in the tool before starting a debug session.","Configure trace-to-program mappings via the Debugger Mappings window.","Verify mappings cover the full address range of the debug target.","For dynamically loaded modules, set up module-to-program mappings after load."],"tags":["debugger","stack-unwinding","mapping","program-location"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}