angr.analyses.decompiler.pattern_match.exact

Tier 2: maximal exactly shared sub-ranges inside a fuzzy family.

Tier 1 (align) discovers that a set of regions are near-duplicates. That is enough to understand a binary, but not enough to merge them: two regions that align at 90% still differ somewhere, and collapsing them into one function would be wrong.

This module finds the sub-ranges on which the occurrences agree exactly on canonical shapes. Because tokenizer already abstracts constants out of a shape, “exactly equal shapes” means “identical modulo constants” – the classic Type-2 clone. Those ranges can be outlined into a single shared function with the differing constants lifted into extra parameters, without changing semantics.

Cores are extracted greedily longest-first; each accepted core masks the token ranges it consumed, and the search continues on the surviving fragments.

class angr.analyses.decompiler.pattern_match.exact.ExactCore

Bases: object

A range on which several occurrences agree exactly on canonical shapes.

occurrences: list[Interval]
length: int
property support: int
property savings: int
__init__(occurrences, length)
Parameters:
Return type:

None

angr.analyses.decompiler.pattern_match.exact.find_exact_cores(ids, occurrences, *, min_len=4, min_support=2, max_cores=32)

Greedily extract maximal exactly-shared cores from a fuzzy family.

Return type:

list[ExactCore]

Parameters: