angr.analyses.decompiler.edits.cache

Decompilation-cache access for the edit layer.

Both kb.decompilations and kb.dec_variables spill to LMDB under memory pressure and hand back a freshly deserialized – that is, different – Python object on reload. Never hold a DecompilationCache or a VariableManagerInternal across anything that can decompile; always re-fetch by key at the point of mutation.

angr.analyses.decompiler.edits.cache.get_cache(kb, func_addr, flavor='pseudocode')

Return the cached decompilation for a function, or None if there is none.

Return type:

DecompilationCache | None

Parameters:
angr.analyses.decompiler.edits.cache.require_cache(kb, func_addr, flavor='pseudocode')

Return the cached decompilation, raising NotDecompiledError if it is missing or empty.

Return type:

DecompilationCache

Parameters:
angr.analyses.decompiler.edits.cache.invalidate(kb, func_addr, *, flavors=None, drop_variables=False)

Drop cached decompilations for a function.

Parameters:
  • flavors (Iterable[str] | None) – Flavors to drop; None drops every flavor currently cached. A prototype change must drop all of them, or a non-pseudocode flavor silently retains the old signature.

  • drop_variables (bool) – Also drop kb.dec_variables[func_addr]. Required for new argument names to take effect, but it discards every rename and manual type for the function – see snapshot_user_edits().

  • kb (KnowledgeBase)

  • func_addr (int)

Return type:

None

angr.analyses.decompiler.edits.cache.snapshot_user_edits(kb, func_addr)

Capture user renames and manual types for a function, keyed by SimVariable.ident.

Used to survive the dec_variables drop that a prototype change requires.

Return type:

dict[str, tuple[str | None, SimType | None]]

Parameters:
angr.analyses.decompiler.edits.cache.restore_user_edits(kb, func_addr, snapshot)

Re-apply a snapshot_user_edits() result after re-decompilation.

Best-effort: idents can change across a re-decompile, so the unmatched ones are returned rather than silently dropped.

Return type:

tuple[int, list[str]]

Parameters:
angr.analyses.decompiler.edits.cache.function_summary(kb, func_addr)

Small helper for edit results: what is currently cached for a function.

Return type:

dict[str, Any]

Parameters: