ida_range

Contains the definition of range_t.

A range is a non-empty continuous range of addresses (specified by its start and end addresses, the end address is excluded from the range). Ranges are stored in the Btree part of the IDA database. To learn more about Btrees (Balanced Trees): [http://www.bluerwhite.org/btree/](http://www.bluerwhite.org/btree/)

Attributes

SWIG_PYTHON_LEGACY_BOOL

RANGE_KIND_UNKNOWN

RANGE_KIND_FUNC

func_t

RANGE_KIND_SEGMENT

segment_t

RANGE_KIND_HIDDEN_RANGE

hidden_range_t

Classes

rangevec_base_t

array_of_rangesets

range_t

rangevec_t

rangeset_t

Functions

range_t_print(→ str)

Helper function. Should not be called directly!

Module Contents

ida_range.SWIG_PYTHON_LEGACY_BOOL
class ida_range.rangevec_base_t(*args)

Bases: object

thisown
push_back(*args) range_t &
pop_back() None
size() size_t
empty() bool
at(_idx: size_t) range_t const &
qclear() None
clear() None
resize(*args) None
grow(*args) None
capacity() size_t
reserve(cnt: size_t) None
truncate() None
swap(r: rangevec_base_t) None
extract() range_t *
inject(s: range_t, len: size_t) None
begin(*args) qvector< range_t >::const_iterator
end(*args) qvector< range_t >::const_iterator
insert(it: range_t, x: range_t) qvector< range_t >::iterator
erase(*args) qvector< range_t >::iterator
find(*args) qvector< range_t >::const_iterator
has(x: range_t) bool
add_unique(x: range_t) bool
append(x: range_t) None
extend(x: rangevec_base_t) None
front
back
class ida_range.array_of_rangesets(*args)

Bases: object

thisown
push_back(*args) rangeset_t &
pop_back() None
size() size_t
empty() bool
at(_idx: size_t) rangeset_t const &
qclear() None
clear() None
resize(*args) None
grow(*args) None
capacity() size_t
reserve(cnt: size_t) None
truncate() None
swap(r: array_of_rangesets) None
extract() rangeset_t *
inject(s: rangeset_t, len: size_t) None
begin(*args) qvector< rangeset_t >::const_iterator
end(*args) qvector< rangeset_t >::const_iterator
insert(it: rangeset_t, x: rangeset_t) qvector< rangeset_t >::iterator
erase(*args) qvector< rangeset_t >::iterator
find(*args) qvector< rangeset_t >::const_iterator
has(x: rangeset_t) bool
add_unique(x: rangeset_t) bool
append(x: rangeset_t) None
extend(x: array_of_rangesets) None
front
back
class ida_range.range_t(ea1: ida_idaapi.ea_t = 0, ea2: ida_idaapi.ea_t = 0)

Bases: object

thisown
start_ea: ida_idaapi.ea_t

start_ea included

end_ea: ida_idaapi.ea_t

end_ea excluded

compare(r: range_t) int
contains(*args) bool

This function has the following signatures:

  1. contains(ea: ida_idaapi.ea_t) -> bool

  2. contains(r: const range_t &) -> bool

# 0: contains(ea: ida_idaapi.ea_t) -> bool

Compare two range_t instances, based on the start_ea.

Is ‘ea’ in the address range?

# 1: contains(r: const range_t &) -> bool

Is every ea in ‘r’ also in this range_t?

overlaps(r: range_t) bool

Is there an ea in ‘r’ that is also in this range_t?

clear() None

Set start_ea, end_ea to 0.

empty() bool

Is the size of the range_t <= 0?

size() asize_t

Get end_ea - start_ea.

intersect(r: range_t) None

Assign the range_t to the intersection between the range_t and ‘r’.

extend(ea: ida_idaapi.ea_t) None

Ensure that the range_t includes ‘ea’.

ida_range.range_t_print(cb: range_t) str

Helper function. Should not be called directly!

class ida_range.rangevec_t

Bases: rangevec_base_t

thisown
ida_range.RANGE_KIND_UNKNOWN
ida_range.RANGE_KIND_FUNC

func_t

ida_range.RANGE_KIND_SEGMENT

segment_t

ida_range.RANGE_KIND_HIDDEN_RANGE

hidden_range_t

class ida_range.rangeset_t(*args)

Bases: object

thisown
swap(r: rangeset_t) None

Set this = ‘r’ and ‘r’ = this. See qvector::swap()

add(*args) bool

This function has the following signatures:

  1. add(range: const range_t &) -> bool

  2. add(start: ida_idaapi.ea_t, _end: ida_idaapi.ea_t) -> bool

  3. add(aset: const rangeset_t &) -> bool

# 0: add(range: const range_t &) -> bool

Add an address range to the set. If ‘range’ intersects an existing element e, then e is extended to include ‘range’, and any superfluous elements (subsets of e) are removed.

Returns:

false if ‘range’ was not added (the set was unchanged)

# 1: add(start: ida_idaapi.ea_t, _end: ida_idaapi.ea_t) -> bool

Create a new range_t from ‘start’ and ‘end’ and add it to the set.

# 2: add(aset: const rangeset_t &) -> bool

Add each element of ‘aset’ to the set.

Returns:

false if no elements were added (the set was unchanged)

sub(*args) bool

This function has the following signatures:

  1. sub(range: const range_t &) -> bool

  2. sub(ea: ida_idaapi.ea_t) -> bool

  3. sub(aset: const rangeset_t &) -> bool

# 0: sub(range: const range_t &) -> bool

Subtract an address range from the set. All subsets of ‘range’ will be removed, and all elements that intersect ‘range’ will be truncated/split so they do not include ‘range’.

Returns:

false if ‘range’ was not subtracted (the set was unchanged)

# 1: sub(ea: ida_idaapi.ea_t) -> bool

Subtract an ea (an range of size 1) from the set. See sub(const range_t &)

# 2: sub(aset: const rangeset_t &) -> bool

Subtract each range in ‘aset’ from the set

Returns:

false if nothing was subtracted (the set was unchanged)

includes(range: range_t) bool

Is every ea in ‘range’ contained in the rangeset?

getrange(idx: int) range_t const &

Get the range_t at index ‘idx’.

lastrange() range_t const &

Get the last range_t in the set.

nranges() size_t

Get the number of range_t elements in the set.

empty() bool

Does the set have zero elements.

clear() None

Delete all elements from the set. See qvector::clear()

has_common(*args) bool

This function has the following signatures:

  1. has_common(range: const range_t &) -> bool

  2. has_common(aset: const rangeset_t &) -> bool

# 0: has_common(range: const range_t &) -> bool

Is there an ea in ‘range’ that is also in the rangeset?

# 1: has_common(aset: const rangeset_t &) -> bool

Does any element of ‘aset’ overlap with an element in this rangeset?. See range_t::overlaps()

contains(*args) bool

This function has the following signatures:

  1. contains(ea: ida_idaapi.ea_t) -> bool

  2. contains(aset: const rangeset_t &) -> bool

# 0: contains(ea: ida_idaapi.ea_t) -> bool

Does an element of the rangeset contain ‘ea’? See range_t::contains(ea_t)

# 1: contains(aset: const rangeset_t &) -> bool

Is every element in ‘aset’ contained in an element of this rangeset?. See range_t::contains(range_t)

intersect(aset: rangeset_t) bool

Set the rangeset to its intersection with ‘aset’.

Returns:

false if the set was unchanged

is_subset_of(aset: rangeset_t) bool

Is every element in the rangeset contained in an element of ‘aset’?

is_equal(aset: rangeset_t) bool

Do this rangeset and ‘aset’ have identical elements?

begin() rangeset_t::iterator

Get an iterator that points to the first element in the set.

end() rangeset_t::iterator

Get an iterator that points to the end of the set. (This is NOT the last element)

find_range(ea: ida_idaapi.ea_t) range_t const *

Get the element from the set that contains ‘ea’.

Returns:

nullptr if there is no such element

cached_range() range_t const *

When searching the rangeset, we keep a cached element to help speed up searches.

Returns:

a pointer to the cached element

next_addr(ea: ida_idaapi.ea_t) ida_idaapi.ea_t

Get the smallest ea_t value greater than ‘ea’ contained in the rangeset.

prev_addr(ea: ida_idaapi.ea_t) ida_idaapi.ea_t

Get the largest ea_t value less than ‘ea’ contained in the rangeset.

next_range(ea: ida_idaapi.ea_t) ida_idaapi.ea_t

Get the smallest ea_t value greater than ‘ea’ that is not in the same range as ‘ea’.

prev_range(ea: ida_idaapi.ea_t) ida_idaapi.ea_t

Get the largest ea_t value less than ‘ea’ that is not in the same range as ‘ea’.

as_rangevec() rangevec_t const &

Return underlying rangevec_t object.