ROSE
0.11.109.0
|
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 180 of file AddressUsageMap.h.
#include <Rose/BinaryAnalysis/Partitioner2/AddressUsageMap.h>
Public Member Functions | |
AddressUsers () | |
Constructs an empty list. More... | |
AddressUsers (SgAsmInstruction *insn, const BasicBlock::Ptr &bb) | |
Constructs a list having one instruction user. More... | |
AddressUsers (const DataBlock::Ptr &db) | |
Constructs a list having one data block user. More... | |
AddressUser | insertInstruction (SgAsmInstruction *, const BasicBlock::Ptr &) |
Insert an instruction/basic block pair. More... | |
AddressUser | insertDataBlock (const DataBlock::Ptr &) |
Insert a data block. More... | |
void | insert (const AddressUsers &) |
Insert one set of address users into another. More... | |
SgAsmInstruction * | eraseInstruction (SgAsmInstruction *, const BasicBlock::Ptr &) |
Erase an instruction/basic block pair from this list. More... | |
DataBlock::Ptr | eraseDataBlock (const DataBlock::Ptr &) |
Erase a data block from this list. More... | |
template<class UserPredicate > | |
AddressUsers | select (UserPredicate predicate) const |
Selects certain users from a list. More... | |
const std::vector< AddressUser > & | addressUsers () const |
Return all address users. More... | |
AddressUsers | instructionUsers () const |
Returns all instruction users. More... | |
AddressUsers | dataBlockUsers () const |
Returns all data block users. More... | |
std::vector< SgAsmInstruction * > | instructions () const |
Returns all instructions. More... | |
std::vector< BasicBlock::Ptr > | instructionOwners () const |
Returns all basic blocks. More... | |
std::vector< DataBlock::Ptr > | dataBlocks () const |
Returns all data blocks. More... | |
size_t | size () const |
Number of address users. More... | |
bool | isEmpty () const |
Determines whether this address user list is empty. More... | |
AddressUsers | intersection (const AddressUsers &) const |
Computes the intersection of this list with another. More... | |
AddressUsers | union_ (const AddressUsers &) const |
Computes the union of this list with another. More... | |
bool | operator== (const AddressUsers &other) const |
True if two lists are equal. More... | |
void | print (std::ostream &) const |
Prints pairs space separated on a single line. More... | |
bool | isConsistent () const |
Check logical consistency. More... | |
SgAsmInstruction * | instructionExists (SgAsmInstruction *) const |
Determines whether the specified instruction or an equivalent exists. More... | |
SgAsmInstruction * | instructionExists (rose_addr_t va) const |
Determines whether the specified instruction or an equivalent exists. More... | |
BasicBlock::Ptr | basicBlockExists (const BasicBlock::Ptr &) const |
Determines whether the specified basic block or an equivalent exists. More... | |
BasicBlock::Ptr | basicBlockExists (rose_addr_t va) const |
Determines whether the specified basic block or an equivalent exists. More... | |
DataBlock::Ptr | dataBlockExists (const DataBlock::Ptr &) const |
Determines whether the specified data block or an equivalent exists. More... | |
DataBlock::Ptr | dataBlockExists (rose_addr_t va, rose_addr_t size) const |
Determines whether the specified data block or an equivalent exists. More... | |
AddressUser | findInstruction (SgAsmInstruction *) const |
Find an AddressUser record for the specified instruction, or equivalent. More... | |
AddressUser | findInstruction (rose_addr_t va) const |
Find an AddressUser record for the specified instruction, or equivalent. More... | |
AddressUser | findBasicBlock (const BasicBlock::Ptr &) const |
Find an AddressUser record for the specified basic block, or equivalent. More... | |
AddressUser | findBasicBlock (rose_addr_t va) const |
Find an AddressUser record for the specified basic block, or equivalent. More... | |
AddressUser | findDataBlock (const DataBlock::Ptr &) const |
Find an AddressUser record for the specified data block, or equivalent. More... | |
AddressUser | findDataBlock (rose_addr_t va, rose_addr_t size) const |
Find an AddressUser record for the specified data block, or equivalent. More... | |
Static Public Member Functions | |
static bool | selectAllUsers (const AddressUser &) |
Selector to select all users. More... | |
static bool | selectBasicBlocks (const AddressUser &user) |
Selector to select instructions and basic blocks. More... | |
static bool | selectDataBlocks (const AddressUser &user) |
Selector to select data blocks. More... | |
|
inline |
Constructs an empty list.
Definition at line 195 of file AddressUsageMap.h.
|
inlineexplicit |
Constructs a list having one instruction user.
Definition at line 198 of file AddressUsageMap.h.
References insertInstruction().
|
inlineexplicit |
Constructs a list having one data block user.
Definition at line 203 of file AddressUsageMap.h.
References insertDataBlock().
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.
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.
BasicBlock::Ptr Rose::BinaryAnalysis::Partitioner2::AddressUsers::basicBlockExists | ( | const BasicBlock::Ptr & | ) | 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.
BasicBlock::Ptr 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.
DataBlock::Ptr Rose::BinaryAnalysis::Partitioner2::AddressUsers::dataBlockExists | ( | const DataBlock::Ptr & | ) | 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.
DataBlock::Ptr 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.
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.
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.
AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findBasicBlock | ( | const BasicBlock::Ptr & | ) | 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.
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.
AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::findDataBlock | ( | const DataBlock::Ptr & | ) | 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.
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.
AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::insertInstruction | ( | SgAsmInstruction * | , |
const BasicBlock::Ptr & | |||
) |
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.
Referenced by AddressUsers().
AddressUser Rose::BinaryAnalysis::Partitioner2::AddressUsers::insertDataBlock | ( | const DataBlock::Ptr & | ) |
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.
Referenced by AddressUsers().
void Rose::BinaryAnalysis::Partitioner2::AddressUsers::insert | ( | const AddressUsers & | ) |
Insert one set of address users into another.
Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::overlapping().
SgAsmInstruction* Rose::BinaryAnalysis::Partitioner2::AddressUsers::eraseInstruction | ( | SgAsmInstruction * | , |
const BasicBlock::Ptr & | |||
) |
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.
DataBlock::Ptr Rose::BinaryAnalysis::Partitioner2::AddressUsers::eraseDataBlock | ( | const DataBlock::Ptr & | ) |
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.
|
inlinestatic |
Selector to select all users.
This selector is the default for methods like AddressUsageMap::overlapping, and causes all users to be selected.
Definition at line 304 of file AddressUsageMap.h.
Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::containedIn(), Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::overlapping(), and Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning().
|
inlinestatic |
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.
Definition at line 312 of file AddressUsageMap.h.
References Rose::BinaryAnalysis::Partitioner2::AddressUser::isBasicBlock().
Referenced by instructionUsers().
|
inlinestatic |
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.
Definition at line 320 of file AddressUsageMap.h.
References Rose::BinaryAnalysis::Partitioner2::AddressUser::isDataBlock().
Referenced by dataBlockUsers().
|
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 328 of file AddressUsageMap.h.
Referenced by dataBlockUsers(), instructionUsers(), and Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning().
|
inline |
Return all address users.
Returns all address users as a vector sorted by starting address.
Definition at line 340 of file AddressUsageMap.h.
|
inline |
Returns all instruction users.
Returns a new list of address users that contains only the instruction users from this list.
Definition at line 347 of file AddressUsageMap.h.
References select(), and selectBasicBlocks().
|
inline |
Returns all data block users.
Returns a new list of address users that contains only the data block users from this list.
Definition at line 354 of file AddressUsageMap.h.
References select(), and selectDataBlocks().
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.
std::vector<BasicBlock::Ptr> 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.
std::vector<DataBlock::Ptr> Rose::BinaryAnalysis::Partitioner2::AddressUsers::dataBlocks | ( | ) | const |
Returns all data blocks.
Returns a list of pointers to distinct data blocks sorted by starting address.
|
inline |
Number of address users.
Definition at line 378 of file AddressUsageMap.h.
|
inline |
Determines whether this address user list is empty.
Returns true if empty, false otherwise.
Definition at line 385 of file AddressUsageMap.h.
Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning().
AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsers::intersection | ( | const AddressUsers & | ) | const |
Computes the intersection of this list with another.
Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsageMap::spanning().
AddressUsers Rose::BinaryAnalysis::Partitioner2::AddressUsers::union_ | ( | const AddressUsers & | ) | const |
Computes the union of this list with another.
bool Rose::BinaryAnalysis::Partitioner2::AddressUsers::operator== | ( | const AddressUsers & | other | ) | const |
True if two lists are equal.
void Rose::BinaryAnalysis::Partitioner2::AddressUsers::print | ( | std::ostream & | ) | const |
Prints pairs space separated on a single line.
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.