{"record":{"id":"dc39ba4adc38fc35","repo":"NationalSecurityAgency/ghidra","slug":"address-does-not-belong-to-a-memory-in-the-trace","errorCode":null,"errorMessage":"Address does not belong to a memory in the trace","messagePattern":"Address does not belong to a memory in the trace","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/PlaceEmuBreakpointActionItem.java","lineNumber":69,"sourceCode":"\tprivate TraceMemoryRegion findRegion() {\n\t\tTraceMemoryRegion region = trace.getMemoryManager().getRegionContaining(snap, address);\n\t\tif (region != null) {\n\t\t\treturn region;\n\t\t}\n\t\tAddressSpace space = address.getAddressSpace();\n\t\tCollection<? extends TraceMemoryRegion> regionsInSpace = trace.getMemoryManager()\n\t\t\t\t.getRegionsIntersecting(Lifespan.at(snap),\n\t\t\t\t\tnew AddressRangeImpl(space.getMinAddress(), space.getMaxAddress()));\n\t\tif (!regionsInSpace.isEmpty()) {\n\t\t\treturn regionsInSpace.iterator().next();\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate TraceObject findBreakpointContainer() {\n\t\tTraceMemoryRegion region = findRegion();\n\t\tif (region == null) {\n\t\t\tthrow new IllegalArgumentException(\"Address does not belong to a memory in the trace\");\n\t\t}\n\t\treturn region.getObject().findSuitableContainerInterface(TraceBreakpointSpec.class);\n\t}\n\n\tprivate String computePath() {\n\t\tString name = createName(address);\n\t\tTraceObject container = findBreakpointContainer();\n\t\tif (container == null) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Address is not associated with a breakpoint container\");\n\t\t}\n\t\tPathFilter specFilter = container.getSchema().searchFor(TraceBreakpointSpec.class, true);\n\t\tif (specFilter == null) {\n\t\t\tthrow new IllegalArgumentException(\"Cannot find path to breakpoint specifications\");\n\t\t}\n\t\tKeyPath specRelPath = specFilter.applyKeys(name).getSingletonPath();\n\t\tif (specRelPath == null) {\n\t\t\tthrow new IllegalArgumentException(\"Too many wildcards to breakpoint specification\");","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/PlaceEmuBreakpointActionItem.java#L51-L87","documentation":"Thrown by PlaceEmuBreakpointActionItem.findBreakpointContainer when no memory region contains the breakpoint address and no region exists anywhere in the address space for the given snap. Placing an emulated breakpoint requires an addressable memory region to anchor the breakpoint's container object.","triggerScenarios":"Executing PlaceEmuBreakpointActionItem at an address with no containing TraceMemoryRegion and no region in the same AddressSpace at the target snap.","commonSituations":"Placing an emu breakpoint at an address outside any mapped region (e.g., in unmapped RAM/flash); doing so before memory regions are defined for the trace; wrong snap chosen before regions were created.","solutions":["Define a memory region covering the target address in the trace before placing the breakpoint.","Select a snap at which the region containing the address exists.","Verify trace.getMemoryManager().getRegionContaining(snap, address) is non-null before invoking the action.","Place the breakpoint at an address inside an already-mapped region."],"exampleFix":"// before\nnew PlaceEmuBreakpointActionItem(trace, snap, addr, len, kinds, sleigh).execute();\n// throws if no region contains addr\n\n// after\nif (trace.getMemoryManager().getRegionContaining(snap, addr) == null) {\n    try (Transaction tx = trace.openTransaction(\"Add region\")) {\n        trace.getMemoryManager().addRegion(\"Memory[ram]\",\n            Lifespan.nowOn(trace), new AddressRangeImpl(addr, len), ...\n        );\n    }\n}\nnew PlaceEmuBreakpointActionItem(trace, snap, addr, len, kinds, sleigh).execute();","handlingStrategy":"validation","validationCode":"boolean inMemory = trace.getMemoryManager().getRegionContaining(snap, address) != null;","typeGuard":"static boolean addressInMemory(Trace t, long snap, Address a) {\n    return t.getMemoryManager().getRegionContaining(snap, a) != null;\n}","tryCatchPattern":"try {\n    item.execute();\n} catch (IllegalArgumentException e) {\n    Msg.showError(this, null, \"Cannot place breakpoint\", e.getMessage());\n}","preventionTips":["Ensure a region covers the address before placing emu breakpoints.","Create regions in the trace for unmapped targets."],"tags":["breakpoint","emu","address","memory-region","trace"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}