angr.rustylib

class angr.rustylib.Segment

Bases: object

classmethod __new__(*args, **kwargs)
copy()
end
size
sort
start
class angr.rustylib.SegmentList

Bases: object

Should be called a SegmentMap!

classmethod __new__(*args, **kwargs)
copy()
has_blocks
is_occupied(address)
next_free_pos(address)
next_pos_with_sort_not_in(address, sorts, max_distance=None)

Returns the next occupied position that is not in the given set of sorts.

occupied_by(address)
occupied_by_sort(address)
occupied_size
occupy(address, size, sort)
release(address, size)
search(addr)

The index of the segment containing addr or, if addr is in a gap, of the next segment after it; None past the last segment. Segments are half-open, so the address just past a segment’s end belongs to whatever follows it.

This is O(n): an index into the map cannot be computed any faster. Prefer the point-query methods (occupied_by, occupied_by_sort, …) wherever an index is not strictly needed.

sort_ratio_backwards(addr, window_size, sort)

The fraction of bytes belonging to segments of sort sort, among the last window_size occupied bytes at or before addr.

The walk starts at the first segment that ends at or after addr (so a segment ending exactly at addr counts) and moves backwards, skipping over gaps, until window_size bytes have been covered. Returns 0.0 when the starting segment has a different sort, or when fewer than window_size occupied bytes are available.

update(other)