angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier

class angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.CmpOp

Bases: Enum

All supported comparison operators.

LT = 0
GT = 1
EQ = 2
NE = 3
class angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.ConditionalRegion

Bases: object

Describes a conditional region.

__init__(variable, op, value, node, parent=None)
Parameters:
variable
op
value
node
parent
class angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.SwitchCaseRegion

Bases: object

Describes an already-recovered switch region.

__init__(variable, node, parent=None)
Parameters:

node (SwitchCaseNode)

variable
node
parent
class angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.SwitchClusterFinder

Bases: SequenceWalker

Find comparisons and switches in order to identify switch clusters.

__init__(node)
var2condnodes: defaultdict[Any, list[ConditionalRegion]]
var2switches: defaultdict[Any, list[SwitchCaseRegion]]
class angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.SwitchClusterReplacer

Bases: SequenceWalker

Replace an identified switch cluster with a newly created SwitchCase node.

__init__(region, to_replace, replace_with)
angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.is_simple_jump_node(node, case_addrs, targets=None)
Return type:

bool

Parameters:

targets (set[int] | None)

angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.filter_cond_regions(cond_regions, case_addrs)

Remove all conditional regions that cannot be merged into switch(es).

Return type:

list[ConditionalRegion]

Parameters:
angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.update_switch_case_list(cases, old_case_id, new_case_id)

Update cases in-place. Make new_case_id directly jump to old_case_id.

Return type:

None

Parameters:
angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.simplify_switch_clusters(region, var2condnodes, var2switches)

Identify switch clusters and simplify each of them.

Parameters:
  • region – The region to simplify.

  • var2condnodes (dict[Any, list[ConditionalRegion]]) – A dict that stores the mapping from (potential) switch variables to conditional regions.

  • var2switches (dict[Any, list[SwitchCaseRegion]]) – A dict that stores the mapping from switch variables to switch-case regions.

Returns:

None

angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.simplify_lowered_switches(region, var2condnodes, functions, ail_manager)

Identify a lowered switch and simplify it into a switch-case if possible.

Parameters:
Returns:

None

angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.simplify_lowered_switches_core(region, var, condnodes, functions, ail_manager)
Return type:

bool

Parameters:
class angr.analyses.decompiler.region_simplifiers.switch_cluster_simplifier.FindFirstNodeInSet

Bases: SequenceWalker

Find the first node out of a set of node appearing in a SequenceNode (and its tree).

__init__(node_set)
Parameters:

node_set (set[BaseNode])