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_patternsdecompilation option that force-enables every registered template, opt-in ones included.
- exception angr.analyses.decompiler.known_patterns.registry.UnknownPatternError¶
Bases:
ValueErrorRaised 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:
- Parameters:
template (KnownPatternTemplate)
- angr.analyses.decompiler.known_patterns.registry.patterns_for(ctx, templates=None, *, enabled_only=False)¶
Instantiate the applicable templates for
ctxinto concrete KnownPatterns.templatesdefaults to the whole registry; withenabled_onlyonly default-enabled templates are used.- Return type:
- Parameters:
ctx (PatternContext)
templates (Iterable[KnownPatternTemplate] | None)
enabled_only (bool)
- angr.analyses.decompiler.known_patterns.registry.resolve_pattern_selection(selection)¶
Resolve a user’s force-enable selection into templates.
selectionis one of:None/ empty: nothing is force-enabled (returns an empty list);"all": every registered template, opt-in ones included;an iterable of template
nameand/orcall_namevalues (a comma-separated string is accepted too, for the string-valued decompilation option).
An unrecognized name raises
UnknownPatternErrorrather than silently selecting nothing.- Return type:
- Parameters:
- angr.analyses.decompiler.known_patterns.registry.partition_templates(gate_ctx, forced=(), templates=None)¶
Split templates into
(enabled, deferred)for one target.enabledare 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.deferredare the ones whose gate needs per-function evidence (seeCorroboratedBy) and must be re-evaluated by the finder once the first matching stage has run.- Return type:
tuple[list[KnownPatternTemplate],list[KnownPatternTemplate]]- Parameters:
gate_ctx (GateContext)
forced (Iterable[KnownPatternTemplate])
templates (Iterable[KnownPatternTemplate] | None)