{"record":{"id":"40715aad1b1919fe","repo":"NationalSecurityAgency/ghidra","slug":"the-given-program-is-dynamic-i-e-a-trace-view","errorCode":null,"errorMessage":"The given program is dynamic, i.e., a trace view","messagePattern":"The given program is dynamic, i\\.e\\., a trace view","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java","lineNumber":1905,"sourceCode":"\t/**\n\t * Get the breakpoint service\n\t * \n\t * @return the service\n\t */\n\tdefault DebuggerLogicalBreakpointService getBreakpointService() {\n\t\treturn requireService(DebuggerLogicalBreakpointService.class);\n\t}\n\n\t/**\n\t * Create a static location at the given address in the current program\n\t * \n\t * @param program the (static) program\n\t * @param address the address\n\t * @return the location\n\t */\n\tdefault ProgramLocation staticLocation(Program program, Address address) {\n\t\tif (program instanceof TraceProgramView) {\n\t\t\tthrow new IllegalArgumentException(\"The given program is dynamic, i.e., a trace view\");\n\t\t}\n\t\treturn new ProgramLocation(program, address);\n\t}\n\n\t/**\n\t * Create a static location at the given address in the current program\n\t * \n\t * @param program the (static) program\n\t * @param addrString the address string\n\t * @return the location\n\t */\n\tdefault ProgramLocation staticLocation(Program program, String addrString) {\n\t\treturn staticLocation(program, program.getAddressFactory().getAddress(addrString));\n\t}\n\n\t/**\n\t * Create a static location at the given address in the current program\n\t * ","sourceCodeStart":1887,"sourceCodeEnd":1923,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java#L1887-L1923","documentation":"Thrown by FlatDebuggerAPI.staticLocation(program, address) when the supplied program is actually a TraceProgramView (a dynamic trace adapter), not a static program. The method is specifically for static program locations.","triggerScenarios":"Calling staticLocation(program, addr) where program is an instance of TraceProgramView (i.e., a trace being viewed as a program).","commonSituations":"Passing the current program without checking whether it is a static program or a trace view; in the Debugger tool the 'current program' may resolve to a trace view; confusing the static and dynamic program concepts.","solutions":["Check !(program instanceof TraceProgramView) before calling staticLocation().","Use requireCurrentProgram() which returns the static program, or explicitly obtain the static program.","For dynamic locations, use the trace-view-based location API instead."],"exampleFix":"// before\nProgramLocation loc = staticLocation(getCurrentProgram(), addr); // throws if it's a view\n\n// after\nProgram p = getCurrentProgram();\nif (p instanceof TraceProgramView) {\n    println(\"Need a static program, not a trace view\");\n    return;\n}\nProgramLocation loc = staticLocation(p, addr);","handlingStrategy":"type-guard","validationCode":"if (program instanceof TraceProgramView) {\n    println(\"Need a static program, got a trace view\");\n    return;\n}","typeGuard":"static boolean isStaticProgram(Program p) {\n    return !(p instanceof TraceProgramView);\n}","tryCatchPattern":"try {\n    ProgramLocation loc = staticLocation(program, addr);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"dynamic\")) {\n        // obtain the static program explicitly and retry\n    } else throw e;\n}","preventionTips":["Check !(program instanceof TraceProgramView) before static-only APIs.","Distinguish static programs from trace views in debugger tool scripts."],"tags":["flat-debugger-api","static-mapping","trace-view","type-validation","debugger"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}