angr.knowledge_plugins.structured_code

class angr.knowledge_plugins.structured_code.SpillingDecompilationDict

Bases: MutableMapping

A dict of decompilation caches, keyed by (function address, flavor), that keeps only the most recently used cache_limit entries in memory and spills the rest to an LMDB database managed by the RuntimeDb knowledge base plugin.

Evicted entries are always serialized and written out (caches are mutated in place, so there is no clean/dirty distinction). Entries that cannot be serialized (e.g. DummyStructuredCodeGenerator or rust-flavor caches) are parked in an unbounded in-memory dict. Spilled entries are deserialized on access with the owning knowledge base’s project/function attached.

__init__(kb, cache_limit=128)
Parameters:
property cache_limit: int
export_serialized()

Export all serializable entries as (key, serialized bytes) pairs. Spilled entries are copied directly out of the LMDB backing store without being deserialized and re-serialized. Entries that cannot be serialized are returned separately in a dict.

Return type:

tuple[list[tuple[tuple[int, str], bytes]], dict[tuple[int, str], DecompilationCache]]

bulk_import_serialized(items)

Move already-serialized decompilation caches directly into the LMDB backing store and register them as spilled, without deserializing them. The bytes must be serialized DecompilationCache messages, i.e., the exact format that eviction writes.

Return type:

None

Parameters:

items (list[tuple[tuple[int, str], bytes]])

class angr.knowledge_plugins.structured_code.StructuredCodeManager

Bases: KnowledgeBasePlugin

A knowledge base plugin to store structured code generator results.

__init__(kb, cache_limit=None)
Parameters:

cache_limit (int | None)

get(key, default=None)
discard(key)
available_flavors(item)
all_flavors(item)
copy()