ROSE  0.11.145.0
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 31 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. More...
 
- Public Types inherited from Sawyer::Attribute::Storage<>
typedef SynchronizationTraits< Sawyer::SingleThreadedTagSync
 

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

 DataBlock (rose_addr_t startVa, SgAsmType *type)
 

Member Typedef Documentation

Shared pointer to a data block.

Definition at line 34 of file DataBlock.h.

Member Function Documentation

static Ptr Rose::BinaryAnalysis::Partitioner2::DataBlock::instance ( rose_addr_t  startVa,
SgAsmType  
)
static

Static allocating constructor.

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.

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 96 of file DataBlock.h.

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

Returns the starting address.

Definition at line 99 of file DataBlock.h.

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

Returns the size in bytes.

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 109 of file DataBlock.h.

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).

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.

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.

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.

AddressInterval Rose::BinaryAnalysis::Partitioner2::DataBlock::extent ( ) const

Addresses represented.

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

A printable name for this data block.

Returns a string like 'data block 0x10001234'.

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: