{"record":{"id":"bb8dd7110fcca4c5","repo":"NationalSecurityAgency/ghidra","slug":"all-trace-memory-is-initialized","errorCode":null,"errorMessage":"All trace memory is initialized","messagePattern":"All trace memory is initialized","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/AbstractDBTraceProgramViewMemory.java","lineNumber":165,"sourceCode":"\t\t// TODO: Copy contents in?\n\t\t//   NOTE: Would not be backed by the fileBytes, but a copy\n\t\tthrow new UnsupportedOperationException();\n\t}\n\n\t@Override\n\tpublic MemoryBlock createInitializedBlock(String name, Address start, long size,\n\t\t\tbyte initialValue, TaskMonitor monitor, boolean overlay)\n\t\t\tthrows LockException, MemoryConflictException, AddressOverflowException,\n\t\t\tCancelledException {\n\t\t// TODO: Create a region?\n\t\tthrow new UnsupportedOperationException();\n\t}\n\n\t@Override\n\tpublic MemoryBlock createUninitializedBlock(String name, Address start, long size,\n\t\t\tboolean overlay)\n\t\t\tthrows LockException, MemoryConflictException, AddressOverflowException {\n\t\tthrow new UnsupportedOperationException(\"All trace memory is initialized\");\n\t}\n\n\t@Override\n\tpublic MemoryBlock createBitMappedBlock(String name, Address start, Address mappedAddress,\n\t\t\tlong length, boolean overlay) throws LockException, MemoryConflictException,\n\t\t\tAddressOverflowException, IllegalArgumentException {\n\t\tthrow new UnsupportedOperationException(\"Mapped blocks are not supported in traces\");\n\t}\n\n\t@Override\n\tpublic MemoryBlock createByteMappedBlock(String name, Address start, Address mappedAddress,\n\t\t\tlong length, ByteMappingScheme byteMappingScheme, boolean overlay)\n\t\t\tthrows LockException, MemoryConflictException, AddressOverflowException,\n\t\t\tIllegalArgumentException {\n\t\tthrow new UnsupportedOperationException(\"Mapped blocks are not supported in traces\");\n\t}\n\n\t@Override","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/AbstractDBTraceProgramViewMemory.java#L147-L183","documentation":"Thrown as UnsupportedOperationException by createUninitializedBlock because Ghidra traces model all memory as conceptually initialized — every byte has a defined value (which may represent 'unknown' state internally) rather than uninitialized holes. The regular-program concept of an uninitialized memory block does not apply to traces.","triggerScenarios":"Calling createUninitializedBlock(name, start, size, overlay) on a DBTraceProgramViewMemory (the trace-backed memory implementation). This API is inherited from the Program Memory interface but is intentionally not implemented for traces.","commonSituations":"Porting Program-creation code that builds uninitialized blocks directly onto a trace program view. Misusing a trace program view (read/snapshot-oriented) as if it were a full editable Program for laying out memory.","solutions":["Do not call createUninitializedBlock on a trace; trace memory is always initialized. Instead create/use initialized regions through the trace's memory manager.","If you need an 'unknown' region, create an initialized block and leave its state as UNKNOWN via the trace memory-state API.","Use a real Program (not a trace program view) if your workflow genuinely requires uninitialized blocks."],"exampleFix":"// before\nmem.createUninitializedBlock(\"bss\", startAddr, size, false);\n\n// after\n// trace memory is always initialized; create a region instead\ntrace.getMemoryManager().createRegion(\"bss\", snap, range);","handlingStrategy":"validation","validationCode":"// Trace memory is always initialized; skip createUninitializedBlock on trace views\nif (!(program.getMemory() instanceof DBTraceProgramViewMemory)) {\n    mem.createUninitializedBlock(name, start, size, overlay);\n}","typeGuard":"// Detect a trace-backed memory implementation\nstatic boolean isTraceMemory(Memory m) {\n    return m instanceof DBTraceProgramViewMemory;\n}","tryCatchPattern":null,"preventionTips":["Do not call createUninitializedBlock on trace views; memory is always initialized.","Branch memory-setup code to skip trace views.","Use the trace memory manager to create regions instead of Program block APIs."],"tags":["trace-modeling","memory","unsupported-operation","block","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}