angr.utils.cow_interval_map

type angr.utils.cow_interval_map.Segment[V] = tuple[int, int, V]
class angr.utils.cow_interval_map.IntervalMapCOW

Bases: Generic[V]

A piecewise-constant map from integers to values, stored as sorted, non-overlapping segments [start, end) -> value.

CHUNK_SIZE: int = 64
__init__(coalesce_equal=False)
Parameters:

coalesce_equal (bool) – Merge adjacent segments whose values are equal (==). Otherwise only adjacent segments bound to the very same object are merged. Use it only for immutable values.

copy()
Return type:

IntervalMapCOW[V]

get[TD](key, default=None)
Return type:

Union[V, TD]

Parameters:
  • key (int)

  • default (TD)

next_key(key)

Return the smallest bound key that is >= key, or None.

Return type:

int | None

Parameters:

key (int)

segment_count()
Return type:

int

segments()
Return type:

Iterator[Segment[V]]

overlapping(lo, hi)

Yield (unclipped) segments that overlap [lo, hi), in ascending order.

Return type:

Iterator[Segment[V]]

Parameters:
unshared_segments(other)

Yield segments of other that live in chunks this map does not share. Every other segment of other is bound identically in this map.

Return type:

Iterator[Segment[V]]

Parameters:

other (IntervalMapCOW[V])

assign(lo, hi, value)

Bind every key in [lo, hi) to value.

Return type:

None

Parameters:
pop_range(lo, hi)

Unbind every key in [lo, hi) and return the removed bindings, clipped to [lo, hi).

Return type:

list[Segment[V]]

Parameters:
pop[TD](key, *default)
Return type:

Union[V, TD]

Parameters:
  • key (int)

  • default (TD)