angr.storage.memory_mixins.paged_memory.pages.symbolic_bitmap

class angr.storage.memory_mixins.paged_memory.pages.symbolic_bitmap.SymbolicBitmap

Bases: object

Tracks, for every byte of an UltraPage, whether that byte is symbolic or not.

The map is stored as a bitmap where the i-th bit of the map lives in bit i & 7 of byte i >> 3 (least-significant bit first). This makes int.from_bytes(..., "little") a direct view of the map as a big integer and lets range scans be done with bit_length() instead of a Python-level loop.

A page whose map is uniform (all bytes are symbolic or concrete) does not store any map.

All ranges are half-open [start, stop) and are assumed to lie within [0, size].

__init__(size, value=0)
Parameters:
size
property nbytes: int

The number of bytes of backing store this map currently occupies (0 while uniform).

property uniform_value: int | None

Return 0/1 if every byte of the page has that symbolic-ness, or None if the map is mixed.

get(i)

Return 1 if byte i is symbolic, 0 otherwise.

Return type:

int

Parameters:

i (int)

set(i, value)

Mark byte i as symbolic (value truthy) or concrete.

Return type:

None

Parameters:
set_range(start, stop)

Mark [start, stop) as symbolic.

Return type:

None

Parameters:
clear_range(start, stop)

Mark [start, stop) as concrete.

Return type:

None

Parameters:
next_set(start, stop)

Return the smallest i in [start, stop) whose byte is symbolic, or stop if there is none.

A whole range is turned into one big integer and located with (w & -w).bit_length() rather than being walked bit by bit. Long ranges are probed 64 bits at a time first.

Return type:

int

Parameters:
next_clear(start, stop)

Return the smallest i in [start, stop) whose byte is concrete, or stop if there is none.

Return type:

int

Parameters:
all_set(start, stop)

Return True if every byte in [start, stop) is symbolic.

Return type:

bool

Parameters:
any_set(start, stop)

Return True if any byte in [start, stop) is symbolic.

Return type:

bool

Parameters:
view(start, stop)

Return the packed bits covering [start, stop): bit i of the result is byte start + i of the page.

When start is byte-aligned, the result is a writable view of this map’s own backing store, so a native consumer (e.g., unicorn engine) can update the page’s symbolic-ness in place. Returning such a view pins the backing store: it may no longer be dropped in favor of the uniform representation.

An unaligned start cannot be expressed as a view of the backing store, so the bits are shifted into place and returned read-only. Consumers like unicorn engine should not use this view for writing!

Return type:

memoryview

Parameters:
copy()
Return type:

SymbolicBitmap