angr.analyses.decompiler.known_patterns.registry

The template registry: every KnownPatternTemplate the package defines, keyed by call name and by human name, plus the helpers that turn a user’s selection or a target’s gates into the list of templates to match with.

Kept apart from the package __init__ so that the finder and the call-info helpers can import it at module load without a cycle.

angr.analyses.decompiler.known_patterns.registry.ALL_PATTERNS = 'all'

Value of the known_patterns decompilation option that force-enables every registered template, opt-in ones included.

exception angr.analyses.decompiler.known_patterns.registry.UnknownPatternError

Bases: ValueError

Raised when a pattern selection names a template that is not registered.

angr.analyses.decompiler.known_patterns.registry.register_pattern_template(template)

Register a KnownPatternTemplate. Call names are unique across templates (the architecture / runtime conditionals live inside each template’s build).

Return type:

None

Parameters:

template (KnownPatternTemplate)

angr.analyses.decompiler.known_patterns.registry.patterns_for(ctx, templates=None, *, enabled_only=False)

Instantiate the applicable templates for ctx into concrete KnownPatterns. templates defaults to the whole registry; with enabled_only only default-enabled templates are used.

Return type:

list[KnownPattern]

Parameters:
angr.analyses.decompiler.known_patterns.registry.resolve_pattern_selection(selection)

Resolve a user’s force-enable selection into templates.

selection is one of:

  • None / empty: nothing is force-enabled (returns an empty list);

  • "all": every registered template, opt-in ones included;

  • an iterable of template name and/or call_name values (a comma-separated string is accepted too, for the string-valued decompilation option).

An unrecognized name raises UnknownPatternError rather than silently selecting nothing.

Return type:

list[KnownPatternTemplate]

Parameters:

selection (str | Iterable[str] | None)

angr.analyses.decompiler.known_patterns.registry.partition_templates(gate_ctx, forced=(), templates=None)

Split templates into (enabled, deferred) for one target.

enabled are the templates to match with right away: default-on ones, ones the caller force-enabled, and ones whose gate already opens on target evidence alone. deferred are the ones whose gate needs per-function evidence (see CorroboratedBy) and must be re-evaluated by the finder once the first matching stage has run.

Return type:

tuple[list[KnownPatternTemplate], list[KnownPatternTemplate]]

Parameters: