{"record":{"id":"a9cf3b459ccad843","repo":"NationalSecurityAgency/ghidra","slug":"associated-symbol-and-reference-must-have-connecte","errorCode":null,"errorMessage":"Associated symbol and reference must have connected lifespans","messagePattern":"Associated symbol and reference must have connected lifespans","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceReference.java","lineNumber":157,"sourceCode":"\t}\n\n\t@Override\n\tpublic void setAssociatedSymbol(Symbol symbol) {\n\t\ttry (LockHold hold = LockHold.lock(ent.space.lock.writeLock())) {\n\t\t\tAbstractDBTraceSymbol dbSym = getTrace().getSymbolManager().assertIsMine(symbol);\n\t\t\tif (ent.symbolId == symbol.getID()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tAddress toAddress = getToAddress();\n\t\t\tif (!Objects.equals(symbol.getAddress(), toAddress)) {\n\t\t\t\tthrow new IllegalArgumentException(String.format(\n\t\t\t\t\t\"Symbol address (%s) of '%s' must match Reference's to address (%s)\",\n\t\t\t\t\tsymbol.getAddress(), symbol.getName(), toAddress));\n\t\t\t}\n\t\t\tif (symbol instanceof TraceSymbolWithLifespan) {\n\t\t\t\tTraceSymbolWithLifespan symWl = (TraceSymbolWithLifespan) symbol;\n\t\t\t\tif (!symWl.getLifespan().intersects(getLifespan())) {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"Associated symbol and reference must have connected lifespans\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tent.setSymbolId(symbol.getID());\n\t\t\tgetTrace().setChanged(new TraceChangeRecord<>(TraceEvents.SYMBOL_ASSOCIATION_ADDED,\n\t\t\t\tent.space.space, dbSym, null, this));\n\t\t}\n\t}\n\n\t@Override\n\tpublic void clearAssociatedSymbol() {\n\t\ttry (LockHold hold = LockHold.lock(ent.space.lock.writeLock())) {\n\t\t\tif (ent.symbolId == -1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tTraceSymbol oldSymbol = getTrace().getSymbolManager().getSymbolByID(ent.symbolId);\n\t\t\tent.setSymbolId(-1);\n\t\t\tgetTrace().setChanged(new TraceChangeRecord<>(TraceEvents.SYMBOL_ASSOCIATION_REMOVED,","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceReference.java#L139-L175","documentation":"Thrown as IllegalArgumentException by DBTraceReference.setAssociatedSymbol when the associated symbol implements TraceSymbolWithLifespan and its lifespan does not intersect the reference's lifespan. Both the symbol and the reference exist over a range of snaps; associating them is only valid where they coexist, so an empty intersection is rejected after the address check passes.","triggerScenarios":"Associating a symbol whose lifespan is [0,5] with a reference whose lifespan is [6,10]. Setting an association across a snap where the symbol was not yet / no longer defined.","commonSituations":"Time-travel debugging where symbols and references have different lifespans; importing reference data from a snap outside the symbol's window.","solutions":["Ensure the symbol's lifespan overlaps the reference's: extend the symbol's lifespan to cover the reference's snap range.","Adjust the reference's lifespan to fall within the symbol's lifespan before associating.","Create a separate symbol instance for the relevant snap window."],"exampleFix":"// before\nref.setAssociatedSymbol(sym); // disjoint lifespans\n// after\n// widen symbol lifespan to intersect reference's\nsym.setLifespan(Lifespan.union(sym.getLifespan(), ref.getLifespan()));\nref.setAssociatedSymbol(sym);","handlingStrategy":"validation","validationCode":"if (symbol instanceof TraceSymbolWithLifespan) {\n    Lifespan symSpan = ((TraceSymbolWithLifespan) symbol).getLifespan();\n    if (!symSpan.intersects(ref.getLifespan())) {\n        // widen symbol lifespan or skip association\n    }\n}\nref.setAssociatedSymbol(symbol);","typeGuard":"static boolean lifespansConnected(TraceSymbolWithLifespan s, Reference r) {\n    return s.getLifespan().intersects(r.getLifespan());\n}","tryCatchPattern":null,"preventionTips":["Ensure symbol and reference lifespans overlap before associating.","Widen symbol lifespan to cover the reference snap range."],"tags":["reference","symbol","lifespan","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}