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

Description

Data block information.

A data block represents static data with a type. Data blocks are identified by a key consisting of their starting address and total size. Data blocks can be either attached to the partitioner or in a detached state. A block that is attached will be present in the Address Usage Map (AUM), but the AUM will store only one DataBlock object per distinct key.

A data block can be owned by multiple basic blocks and/or functions. If an owning basic block or function is attached to the partitioner then the data block will also be attached. However, data blocks can be attached when some or all of their owners are in the detached state. When attaching a basic block or function that owns a data block, if the AUM already has a different but equivaent (by keys) data block then the owning basic block or function will be adjusted to point to the equivalent data block.

Definition at line 35 of file DataBlock.h.

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

Inheritance diagram for Rose::BinaryAnalysis::Partitioner2::DataBlock:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Partitioner2::DataBlock:
Collaboration graph
[legend]

Public Types

typedef Sawyer::SharedPointer< DataBlockPtr
 Shared pointer to a data block.
 
- Public Types inherited from Sawyer::Attribute::Storage< SyncTag >
typedef SynchronizationTraits< SyncTag > Sync
 

Public Member Functions

bool isFrozen () const
 Determine if data block is read-only.
 
rose_addr_t address () const
 Returns the starting address.
 
size_t size () const
 Returns the size in bytes.
 
size_t nAttachedOwners () const
 Number of attached basic block and function owners.
 
const std::vector< FunctionPtr > & attachedFunctionOwners () const
 Functions that are attached to the partitioner and own this data block.
 
const std::vector< BasicBlockPtr > & attachedBasicBlockOwners () const
 Basic blocks that are attached to the partitioner and own this data block.
 
AddressInterval extent () const
 Addresses represented.
 
std::string printableName () const
 A printable name for this data block.
 
std::vector< uint8_t > read (const MemoryMapPtr &) const
 Read static data from a memory map.
 
SgAsmTypetype () const
 Property: Type of data stored in this block.
 
void type (SgAsmType *t)
 Property: Type of data stored in this block.
 
const std::string & comment () const
 Property: Comment.
 
void comment (const std::string &s)
 Property: Comment.
 
const SourceLocationsourceLocation () const
 Property: Optional location of data in source code.
 
void sourceLocation (const SourceLocation &)
 Property: Optional location of data in source code.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 
- Public Member Functions inherited from Sawyer::Attribute::Storage< SyncTag >
 Storage ()
 Default constructor.
 
 Storage (const Storage &other)
 Copy constructor.
 
Storageoperator= (const Storage &other)
 Assignment operator.
 
bool attributeExists (Id id) const
 Check attribute existence.
 
void eraseAttribute (Id id)
 Erase an attribute.
 
void clearAttributes ()
 Erase all attributes.
 
template<typename T >
void setAttribute (Id id, const T &value)
 Store an attribute.
 
template<typename T >
bool setAttributeMaybe (Id id, const T &value)
 Store an attribute if not already present.
 
template<typename T >
getAttribute (Id id) const
 Get an attribute that is known to exist.
 
template<typename T >
Sawyer::Optional< T > getAttributeMaybe (const Id id) const
 Return an attribute if it exists, or else nothing.
 
template<typename T >
attributeOrElse (Id id, const T &dflt) const
 Return an attribute or a specified value.
 
template<typename T >
attributeOrDefault (Id id) const
 Return an attribute or a default-constructed value.
 
template<typename T >
Sawyer::Optional< T > optionalAttribute (Id id) const
 Return the attribute as an optional value.
 
size_t nAttributes () const
 Number of attributes stored.
 
std::vector< IdattributeIds () const
 Returns ID numbers for all IDs stored in this container.
 

Static Public Member Functions

static Ptr instance (rose_addr_t startVa, SgAsmType *)
 Static allocating constructor.
 
static Ptr instanceBytes (rose_addr_t startVa, size_t nBytes)
 Static allocating constructor.
 

Protected Member Functions

 DataBlock (rose_addr_t startVa, SgAsmType *type)
 

Member Typedef Documentation

◆ Ptr

Shared pointer to a data block.

Definition at line 38 of file DataBlock.h.

Member Function Documentation

◆ instanceBytes()

static Ptr Rose::BinaryAnalysis::Partitioner2::DataBlock::instanceBytes ( rose_addr_t  startVa,
size_t  nBytes 
)
static

Static allocating constructor.

Creates a data block whose type is just an array of bytes.

The startVa is the starting address of the data block.

◆ isFrozen()

bool Rose::BinaryAnalysis::Partitioner2::DataBlock::isFrozen ( ) const
inline

Determine if data block is read-only.

Returns true if read-only, false otherwise.

Definition at line 78 of file DataBlock.h.

◆ address()

rose_addr_t Rose::BinaryAnalysis::Partitioner2::DataBlock::address ( ) const
inline

Returns the starting address.

Definition at line 81 of file DataBlock.h.

◆ type() [1/2]

SgAsmType * Rose::BinaryAnalysis::Partitioner2::DataBlock::type ( ) const
inline

Property: Type of data stored in this block.

The type can only be changed when the data block is in a detached state (i.e., when isFrozen is false).

Definition at line 91 of file DataBlock.h.

◆ type() [2/2]

void Rose::BinaryAnalysis::Partitioner2::DataBlock::type ( SgAsmType t)

Property: Type of data stored in this block.

The type can only be changed when the data block is in a detached state (i.e., when isFrozen is false).

◆ nAttachedOwners()

size_t Rose::BinaryAnalysis::Partitioner2::DataBlock::nAttachedOwners ( ) const

Number of attached basic block and function owners.

Returns the number of basic blocks and functions that are attached to the CFG/AUM and that own this data block.

◆ attachedFunctionOwners()

const std::vector< FunctionPtr > & Rose::BinaryAnalysis::Partitioner2::DataBlock::attachedFunctionOwners ( ) const

Functions that are attached to the partitioner and own this data block.

The returned vector is sorted and has unique elements.

◆ attachedBasicBlockOwners()

const std::vector< BasicBlockPtr > & Rose::BinaryAnalysis::Partitioner2::DataBlock::attachedBasicBlockOwners ( ) const

Basic blocks that are attached to the partitioner and own this data block.

The returned vector is sorted and has unique elements.

◆ printableName()

std::string Rose::BinaryAnalysis::Partitioner2::DataBlock::printableName ( ) const

A printable name for this data block.

Returns a string like 'data block 0x10001234'.

◆ read()

std::vector< uint8_t > Rose::BinaryAnalysis::Partitioner2::DataBlock::read ( const MemoryMapPtr ) const

Read static data from a memory map.

This is a simple wrapper around memory map reading functionality so that the data for this static data block can be retrieved from the memory map without needing to know how to use the quite extensive memory map API. This method reads this object's data from the provided memory map and returns a vector of the bytes. The returned vector will be truncated if any of the bytes of this data block are not present in the map.


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