ROSE 0.11.145.192
Public Member Functions | Static Public Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::AddressUsers Class Reference

Description

List of virtual address users.

This is a list of users of virtual addresses. A user is either an instruction (and basic block owners) or a data block The list is maintained in a sorted order according to instruction or data block comparators. The class ensures that all users in the list have valid pointers and that the list contains no duplicates.

Definition at line 157 of file AddressUsageMap.h.

#include <Rose/BinaryAnalysis/Partitioner2/AddressUsageMap.h>

Public Member Functions

 AddressUsers ()
 Constructs an empty list.
 
 AddressUsers (SgAsmInstruction *insn, const BasicBlockPtr &)
 Constructs a list having one instruction user.
 
 AddressUsers (const DataBlockPtr &)
 Constructs a list having one data block user.
 
AddressUser insertInstruction (SgAsmInstruction *, const BasicBlockPtr &)
 Insert an instruction/basic block pair.
 
AddressUser insertDataBlock (const DataBlockPtr &)
 Insert a data block.
 
void insert (const AddressUsers &)
 Insert one set of address users into another.
 
SgAsmInstructioneraseInstruction (SgAsmInstruction *, const BasicBlockPtr &)
 Erase an instruction/basic block pair from this list.
 
DataBlockPtr eraseDataBlock (const DataBlockPtr &)
 Erase a data block from this list.
 
template<class UserPredicate >
AddressUsers select (UserPredicate predicate) const
 Selects certain users from a list.
 
const std::vector< AddressUser > & addressUsers () const
 Return all address users.
 
AddressUsers instructionUsers () const
 Returns all instruction users.
 
AddressUsers dataBlockUsers () const
 Returns all data block users.
 
std::vector< SgAsmInstruction * > instructions () const
 Returns all instructions.
 
std::vector< BasicBlockPtrinstructionOwners () const
 Returns all basic blocks.
 
std::vector< DataBlockPtrdataBlocks () const
 Returns all data blocks.
 
size_t size () const
 Number of address users.
 
bool isEmpty () const
 Determines whether this address user list is empty.
 
AddressUsers intersection (const AddressUsers &) const
 Computes the intersection of this list with another.
 
AddressUsers union_ (const AddressUsers &) const
 Computes the union of this list with another.
 
bool operator== (const AddressUsers &other) const
 True if two lists are equal.
 
void print (std::ostream &) const
 Prints pairs space separated on a single line.
 
bool isConsistent () const
 Check logical consistency.
 
SgAsmInstructioninstructionExists (SgAsmInstruction *) const
 Determines whether the specified instruction or an equivalent exists.
 
SgAsmInstructioninstructionExists (rose_addr_t va) const
 Determines whether the specified instruction or an equivalent exists.
 
BasicBlockPtr basicBlockExists (const BasicBlockPtr &) const
 Determines whether the specified basic block or an equivalent exists.
 
BasicBlockPtr basicBlockExists (rose_addr_t va) const
 Determines whether the specified basic block or an equivalent exists.
 
DataBlockPtr dataBlockExists (const DataBlockPtr &) const
 Determines whether the specified data block or an equivalent exists.
 
DataBlockPtr dataBlockExists (rose_addr_t va, rose_addr_t size) const
 Determines whether the specified data block or an equivalent exists.
 
AddressUser findInstruction (SgAsmInstruction *) const
 Find an AddressUser record for the specified instruction, or equivalent.
 
AddressUser findInstruction (rose_addr_t va) const
 Find an AddressUser record for the specified instruction, or equivalent.
 
AddressUser findBasicBlock (const BasicBlockPtr &) const
 Find an AddressUser record for the specified basic block, or equivalent.
 
AddressUser findBasicBlock (rose_addr_t va) const
 Find an AddressUser record for the specified basic block, or equivalent.
 
AddressUser findDataBlock (const DataBlockPtr &) const
 Find an AddressUser record for the specified data block, or equivalent.
 
AddressUser findDataBlock (rose_addr_t va, rose_addr_t size) const
 Find an AddressUser record for the specified data block, or equivalent.
 

Static Public Member Functions

static bool selectAllUsers (const AddressUser &)
 Selector to select all users.
 
static bool selectBasicBlocks (const AddressUser &)
 Selector to select instructions and basic blocks.
 
static bool selectDataBlocks (const AddressUser &)
 Selector to select data blocks.
 

Member Function Documentation

◆ instructionExists() [1/2]

SgAsmInstruction * Rose::BinaryAnalysis::Partitioner2::AddressUsers::instructionExists ( SgAsmInstruction ) const

Determines whether the specified instruction or an equivalent exists.

Returns a non-null pointer to the instruction contained in this object if the specified instruction or an equivalent can be found, otherwise returns a null pointer. The search can be done by SgAsmInstruction pointer or a starting address.

◆ instructionExists() [2/2]

SgAsmInstruction * Rose::BinaryAnalysis::Partitioner2::AddressUsers::instructionExists ( rose_addr_t  va) const

Determines whether the specified instruction or an equivalent exists.

Returns a non-null pointer to the instruction contained in this object if the specified instruction or an equivalent can be found, otherwise returns a null pointer. The search can be done by SgAsmInstruction pointer or a starting address.

◆ basicBlockExists() [1/2]

BasicBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUsers::basicBlockExists ( const BasicBlockPtr ) const

Determines whether the specified basic block or an equivalent exists.

Returns a non-null pointer to the basic block contained in this object if the specified basic block or an equivalent can be found, otherwise returns a null pointer. The search can be done by BasicBlock object or a starting address. The basic block is found only if its first instruction is present.

◆ basicBlockExists() [2/2]

BasicBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUsers::basicBlockExists ( rose_addr_t  va) const

Determines whether the specified basic block or an equivalent exists.

Returns a non-null pointer to the basic block contained in this object if the specified basic block or an equivalent can be found, otherwise returns a null pointer. The search can be done by BasicBlock object or a starting address. The basic block is found only if its first instruction is present.

◆ dataBlockExists() [1/2]

DataBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUsers::dataBlockExists ( const DataBlockPtr ) const

Determines whether the specified data block or an equivalent exists.

Returns a non-null pointer to the data block contained in this object if the specified data block or an equivalent can be found, otherwise returns a null pointer. The search can be done by DataBlock object or a starting address and size.

◆ dataBlockExists() [2/2]

DataBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUsers::dataBlockExists ( rose_addr_t  va,
rose_addr_t  size 
) const

Determines whether the specified data block or an equivalent exists.

Returns a non-null pointer to the data block contained in this object if the specified data block or an equivalent can be found, otherwise returns a null pointer. The search can be done by DataBlock object or a starting address and size.

◆ findInstruction() [1/2]

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findInstruction ( SgAsmInstruction ) const

Find an AddressUser record for the specified instruction, or equivalent.

If the specified instruction or an equivalent instruction exists in this object, then its record is returned, otherwise an empty record is returned. The instruction can be indicated by either an SgAsmInstruction object or a starting address.

◆ findInstruction() [2/2]

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findInstruction ( rose_addr_t  va) const

Find an AddressUser record for the specified instruction, or equivalent.

If the specified instruction or an equivalent instruction exists in this object, then its record is returned, otherwise an empty record is returned. The instruction can be indicated by either an SgAsmInstruction object or a starting address.

◆ findBasicBlock() [1/2]

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findBasicBlock ( const BasicBlockPtr ) const

Find an AddressUser record for the specified basic block, or equivalent.

If the specified basic block or an equivalent basic block (based on starting address) is present in this list, then return its record, otherwise return an empty record. This looks up the basic block by looking for its first instruction, therefore returns a record only if the first instruction is present. The basic block can be specified by either a BasicBlock object or a starting address.

◆ findBasicBlock() [2/2]

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findBasicBlock ( rose_addr_t  va) const

Find an AddressUser record for the specified basic block, or equivalent.

If the specified basic block or an equivalent basic block (based on starting address) is present in this list, then return its record, otherwise return an empty record. This looks up the basic block by looking for its first instruction, therefore returns a record only if the first instruction is present. The basic block can be specified by either a BasicBlock object or a starting address.

◆ findDataBlock() [1/2]

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findDataBlock ( const DataBlockPtr ) const

Find an AddressUser record for the specified data block, or equivalent.

If the specified data block or an equivalent data block exists in this object, then its record is returned, otherwise an empty record is returned. The data block can be specified by either a DataBlock object or a starting address and size.

◆ findDataBlock() [2/2]

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findDataBlock ( rose_addr_t  va,
rose_addr_t  size 
) const

Find an AddressUser record for the specified data block, or equivalent.

If the specified data block or an equivalent data block exists in this object, then its record is returned, otherwise an empty record is returned. The data block can be specified by either a DataBlock object or a starting address and size.

◆ insertInstruction()

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::insertInstruction ( SgAsmInstruction ,
const BasicBlockPtr  
)

Insert an instruction/basic block pair.

Neither the instruction nor the basic block may be null. If this list already contains the specified instruction, then the specified basic block is merged into its owner list and a reference to that user is returned.

◆ insertDataBlock()

AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::insertDataBlock ( const DataBlockPtr )

Insert a data block.

The specified data block is inserted into this list of users unless it or an equivalent data block is already present. Returns the record describing the data block.

◆ eraseInstruction()

SgAsmInstruction * Rose::BinaryAnalysis::Partitioner2::AddressUsers::eraseInstruction ( SgAsmInstruction ,
const BasicBlockPtr  
)

Erase an instruction/basic block pair from this list.

Finds the specified instruction or equivalent in the list and removes the specified basic block owner. If this results in the instruction not being owned by any blocks then the instruction is removed. Returns the affected instruction.

◆ eraseDataBlock()

DataBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUsers::eraseDataBlock ( const DataBlockPtr )

Erase a data block from this list.

Erases the specified data block or equivalent from this list. If the data block is null or the list does not contain the data block then this is a no-op. Returns the erased data block.

◆ selectAllUsers()

static bool Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectAllUsers ( const AddressUser )
static

Selector to select all users.

This selector is the default for methods like AddressUsageMap::overlapping, and causes all users to be selected.

◆ selectBasicBlocks()

static bool Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectBasicBlocks ( const AddressUser )
static

Selector to select instructions and basic blocks.

This selector can be passed as the argument to the select method, or to methods like AddressUsageMap::overlapping to select only those users that are instructions and basic blocks.

◆ selectDataBlocks()

static bool Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectDataBlocks ( const AddressUser )
static

Selector to select data blocks.

This selector can be passed as the argument to the select method, or to methods like AddressUsageMap::overlapping to select only those users that are data blocks.

◆ select()

template<class UserPredicate >
AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsers::select ( UserPredicate  predicate) const
inline

Selects certain users from a list.

Returns a new address users list containing only those users for which the predicate returns true.

Definition at line 292 of file AddressUsageMap.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning().

◆ addressUsers()

const std::vector< AddressUser > & Rose::BinaryAnalysis::Partitioner2::AddressUsers::addressUsers ( ) const

Return all address users.

Returns all address users as a vector sorted by starting address.

◆ instructionUsers()

AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsers::instructionUsers ( ) const

Returns all instruction users.

Returns a new list of address users that contains only the instruction users from this list.

◆ dataBlockUsers()

AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsers::dataBlockUsers ( ) const

Returns all data block users.

Returns a new list of address users that contains only the data block users from this list.

◆ instructions()

std::vector< SgAsmInstruction * > Rose::BinaryAnalysis::Partitioner2::AddressUsers::instructions ( ) const

Returns all instructions.

Returns a list of distinct instructions sorted by starting address. The return value is not an AddressUsers because it is more useful to have a list of distinct instructions, and because the instructionUsers method returns the other information already.

◆ instructionOwners()

std::vector< BasicBlockPtr > Rose::BinaryAnalysis::Partitioner2::AddressUsers::instructionOwners ( ) const

Returns all basic blocks.

Returns a list of pointers to distinct basic blocks sorted by starting address. The return value is not an AddressUsers because it is more useful to have a list of distinct basic blocks, and because the instructionUsers method returns the other information already.

◆ dataBlocks()

std::vector< DataBlockPtr > Rose::BinaryAnalysis::Partitioner2::AddressUsers::dataBlocks ( ) const

Returns all data blocks.

Returns a list of pointers to distinct data blocks sorted by starting address.

◆ isEmpty()

bool Rose::BinaryAnalysis::Partitioner2::AddressUsers::isEmpty ( ) const

Determines whether this address user list is empty.

Returns true if empty, false otherwise.

Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning().

◆ isConsistent()

bool Rose::BinaryAnalysis::Partitioner2::AddressUsers::isConsistent ( ) const

Check logical consistency.

Ensures that this object is logically consistent. If assertions are enabled this asserts, otherwise it returns false.


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