ROSE  0.9.9.109
Public Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::AddressUsageMap Class Reference

Description

Address usage map.

Keeps track of which instructions and data span each virtual address and are represented by the control flow graph. The user never modifies this data structure directly (and can't since the partitioner never returns a non-const reference), but only modifies it through the partitioner's API.

Definition at line 347 of file AddressUsageMap.h.

#include <AddressUsageMap.h>

Public Member Functions

bool isEmpty () const
 Determines whether a map is empty. More...
 
void clear ()
 Reset map to initial empty state. More...
 
size_t size () const
 Number of addresses represented by the map. More...
 
AddressInterval hull () const
 Minimum and maximum used addresses. More...
 
AddressIntervalSet extent () const
 Addresses represented. More...
 
bool exists (rose_addr_t va) const
 Predicate to determine whether an address is used. More...
 
AddressInterval nextUnused (rose_addr_t minVa) const
 Next unused address interval. More...
 
bool instructionExists (SgAsmInstruction *) const
 Determines whether an instruction exists in the map. More...
 
Sawyer::Optional< AddressUserinstructionExists (rose_addr_t startOfInsn) const
 Determines if an address is the start of an instruction. More...
 
BasicBlock::Ptr basicBlockExists (rose_addr_t startOfBlock) const
 Determines if an address is the start of a basic block. More...
 
OwnedDataBlock dataBlockExists (rose_addr_t startOfBlock) const
 Determines if an address is the start of a data block. More...
 
OwnedDataBlock dataBlockExists (const DataBlock::Ptr &) const
 Determines whether a data block exists in the map. More...
 
Sawyer::Optional< rose_addr_t > leastUnmapped (rose_addr_t startVa) const
 Returns the least unmapped address with specified lower limit. More...
 
void print (std::ostream &, const std::string &prefix="") const
 Dump the contents of this AUM to a stream. More...
 
bool anyExists (const AddressInterval &) const
 Predicate to determine whether any of the specified addresses are used. More...
 
bool anyExists (const AddressIntervalSet &) const
 Predicate to determine whether any of the specified addresses are used. More...
 
AddressIntervalSet unusedExtent (size_t nBits) const
 Addresses not represented. More...
 
AddressIntervalSet unusedExtent (const AddressInterval &) const
 Addresses not represented. More...
 
AddressIntervalSet unusedExtent (const AddressIntervalSet &) const
 Addresses not represented. More...
 
AddressUsers spanning (const AddressInterval &interval) const
 Find address users that span the entire interval. More...
 
template<class UserPredicate >
AddressUsers spanning (const AddressInterval &interval, UserPredicate userPredicate) const
 Find address users that span the entire interval. More...
 
AddressUsers overlapping (const AddressInterval &interval) const
 Users that overlap the interval. More...
 
template<class UserPredicate >
AddressUsers overlapping (const AddressInterval &interval, UserPredicate userPredicate) const
 Users that overlap the interval. More...
 
AddressUsers containedIn (const AddressInterval &interval) const
 Users that are fully contained in the interval. More...
 
template<class UserPredicate >
AddressUsers containedIn (const AddressInterval &interval, UserPredicate userPredicate) const
 Users that are fully contained in the interval. More...
 

Member Function Documentation

bool Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::isEmpty ( ) const
inline

Determines whether a map is empty.

Returns true if the map contains no instructions or data, false if it contains at least one instruction or at least one data block.

Definition at line 366 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::isEmpty().

void Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::clear ( )
inline

Reset map to initial empty state.

Definition at line 369 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::clear().

size_t Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::size ( ) const
inline

Number of addresses represented by the map.

Returns the number of addresses that have at least one user. This is a constant-time operation.

Definition at line 374 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::size().

Referenced by Rose::BinaryAnalysis::Partitioner2::Partitioner::nBytes().

AddressInterval Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::hull ( ) const
inline

Minimum and maximum used addresses.

Returns minimum and maximum addresses that exist in this address usage map. If the map is empty then the returned interval is empty, containing neither a minimum nor maximum address.

Definition at line 380 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::hull().

AddressIntervalSet Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::extent ( ) const

Addresses represented.

Returns the set of addresses that are represented.

bool Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::exists ( rose_addr_t  va) const
inline

Predicate to determine whether an address is used.

Returns true if the specified address belongs to any instruction, basic block, or data block. This is a O(log N) operation where N is the number of contiguous intervals in this address usage map. It may be slightly faster than some of the other methods since it doesn't need to construct a non-POD return value.

Definition at line 392 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::exists().

bool Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::anyExists ( const AddressInterval ) const

Predicate to determine whether any of the specified addresses are used.

Returns true if any address in the specified set or interval belongs to any instruction, basic block, or data block. This may be slightly faster than some of the other predicates because it doesn't need to construct a non-POD return value.

bool Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::anyExists ( const AddressIntervalSet ) const

Predicate to determine whether any of the specified addresses are used.

Returns true if any address in the specified set or interval belongs to any instruction, basic block, or data block. This may be slightly faster than some of the other predicates because it doesn't need to construct a non-POD return value.

AddressIntervalSet Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::unusedExtent ( size_t  nBits) const

Addresses not represented.

Returns the set of addresses that are not represented. The nBits argument is the number of bits in the virtual address space, usually 32 or 64, and must be between 1 and 64, inclusive. Alternatively, an interval or interval set can be supplied to limit the return value.

AddressIntervalSet Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::unusedExtent ( const AddressInterval ) const

Addresses not represented.

Returns the set of addresses that are not represented. The nBits argument is the number of bits in the virtual address space, usually 32 or 64, and must be between 1 and 64, inclusive. Alternatively, an interval or interval set can be supplied to limit the return value.

AddressIntervalSet Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::unusedExtent ( const AddressIntervalSet ) const

Addresses not represented.

Returns the set of addresses that are not represented. The nBits argument is the number of bits in the virtual address space, usually 32 or 64, and must be between 1 and 64, inclusive. Alternatively, an interval or interval set can be supplied to limit the return value.

AddressInterval Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::nextUnused ( rose_addr_t  minVa) const

Next unused address interval.

Returns the next address interval that begins at or after the specified address and which does not correspond to any instruction, basic block, data block, or function. The largest such interval is returned, but it will not contain any values less than minVa. Returns an empty interval if no such interval exists.

bool Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::instructionExists ( SgAsmInstruction ) const

Determines whether an instruction exists in the map.

If the instruction exists in the map then returns true, otherwise false.

Referenced by Rose::BinaryAnalysis::Partitioner2::Partitioner::instructionExists().

Sawyer::Optional<AddressUser> Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::instructionExists ( rose_addr_t  startOfInsn) const

Determines if an address is the start of an instruction.

If the specified address is the starting address of an instruction then the address user information is returned, otherwise nothing is returned.

BasicBlock::Ptr Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::basicBlockExists ( rose_addr_t  startOfBlock) const

Determines if an address is the start of a basic block.

If the specified address is the starting address of a basic block then the basic block pointer is returned, otherwise the null pointer is returned. A basic block exists only when it has at least one instruction; this is contrary to the CFG, where a basic block can be represented by a placeholder with no instructions.

OwnedDataBlock Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::dataBlockExists ( rose_addr_t  startOfBlock) const

Determines if an address is the start of a data block.

If the specified data block exists in the map then its ownership information is returned. Otherwise a default-constructed data block ownership record is created whose isValid method will return false.

OwnedDataBlock Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::dataBlockExists ( const DataBlock::Ptr ) const

Determines whether a data block exists in the map.

If the specified data block exists in the map then return its ownership record, otherwise return a default-constructed ownership record whose isValid method will return false.

AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning ( const AddressInterval interval) const
inline

Find address users that span the entire interval.

The return value is a vector of address users (instructions and/or data blocks) sorted by starting address where each user starts at or before the beginning of the interval and ends at or after the end of the interval. The specified predicate is used to select which users are inserted into the result and should be a functor that takes an AddressUser as an argument and returns true to select that user for inclusion in the result.

Definition at line 462 of file AddressUsageMap.h.

References Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectAllUsers().

template<class UserPredicate >
AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning ( const AddressInterval interval,
UserPredicate  userPredicate 
) const
inline

Find address users that span the entire interval.

The return value is a vector of address users (instructions and/or data blocks) sorted by starting address where each user starts at or before the beginning of the interval and ends at or after the end of the interval. The specified predicate is used to select which users are inserted into the result and should be a functor that takes an AddressUser as an argument and returns true to select that user for inclusion in the result.

Definition at line 467 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::findAll(), Rose::BinaryAnalysis::Partitioner2::AddressUsers::intersection(), Rose::BinaryAnalysis::Partitioner2::AddressUsers::isEmpty(), and Sawyer::Container::Map< K, T, Cmp, Alloc >::Node::value().

AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::overlapping ( const AddressInterval interval) const
inline

Users that overlap the interval.

The return value is a vector of address users (instructions and/or data blocks) sorted by starting address where each user overlaps with the interval. That is, at least one byte of the instruction or data block came from the specified interval of byte addresses. The specified predicate is used to select which users are inserted into the result and should be a functor that takes an AddressUser as an argument and returns true to select that user for inclusion in the result.

Definition at line 489 of file AddressUsageMap.h.

References Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectAllUsers().

template<class UserPredicate >
AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::overlapping ( const AddressInterval interval,
UserPredicate  userPredicate 
) const
inline

Users that overlap the interval.

The return value is a vector of address users (instructions and/or data blocks) sorted by starting address where each user overlaps with the interval. That is, at least one byte of the instruction or data block came from the specified interval of byte addresses. The specified predicate is used to select which users are inserted into the result and should be a functor that takes an AddressUser as an argument and returns true to select that user for inclusion in the result.

Definition at line 494 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::findAll(), Rose::BinaryAnalysis::Partitioner2::AddressUsers::insert(), and Sawyer::Container::Map< K, T, Cmp, Alloc >::Node::value().

AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::containedIn ( const AddressInterval interval) const
inline

Users that are fully contained in the interval.

The return value is a vector of address users (instructions and/or data blocks) sorted by starting address where each user is fully contained within the specified interval. That is, each user starts at or after the beginning of the interval and ends at or before the end of the interval. The specified predicate is used to select which users are inserted into the result and should be a functor that takes an AddressUser as an argument and returns true to select that user for inclusion in the result.

Definition at line 511 of file AddressUsageMap.h.

References Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectAllUsers().

template<class UserPredicate >
AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::containedIn ( const AddressInterval interval,
UserPredicate  userPredicate 
) const

Users that are fully contained in the interval.

The return value is a vector of address users (instructions and/or data blocks) sorted by starting address where each user is fully contained within the specified interval. That is, each user starts at or after the beginning of the interval and ends at or before the end of the interval. The specified predicate is used to select which users are inserted into the result and should be a functor that takes an AddressUser as an argument and returns true to select that user for inclusion in the result.

Sawyer::Optional<rose_addr_t> Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::leastUnmapped ( rose_addr_t  startVa) const
inline

Returns the least unmapped address with specified lower limit.

Returns the smallest unmapped address that is greater than or equal to startVa. If no such address exists then nothing is returned.

Definition at line 525 of file AddressUsageMap.h.

References Sawyer::Container::IntervalMap< I, T, Policy >::leastUnmapped().

void Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::print ( std::ostream &  ,
const std::string &  prefix = "" 
) const

Dump the contents of this AUM to a stream.

The output contains one entry per line and the last line is terminated with a linefeed.


The documentation for this class was generated from the following file: