GTIRB
v2.2.0
GrammaTech Intermediate Representation for Binaries: C++ API
|
A basic block. More...
#include <CodeBlock.hpp>
Public Types | |
template<typename T > | |
using | bytes_iterator = ByteInterval::bytes_iterator< T > |
Iterator over bytes in this block. More... | |
template<typename T > | |
using | bytes_range = ByteInterval::bytes_range< T > |
Range over bytes in this block. More... | |
template<typename T > | |
using | const_bytes_iterator = ByteInterval::const_bytes_iterator< T > |
Const iterator over bytes in this block. More... | |
template<typename T > | |
using | const_bytes_range = ByteInterval::const_bytes_range< T > |
Const range over bytes in this block. More... | |
Public Member Functions | |
template<typename T > | |
bytes_range< T > | bytes () |
Get a range of the bytes in this block. More... | |
template<typename T > | |
const_bytes_range< T > | bytes () const |
Get a range of the bytes in this block. More... | |
template<typename T > | |
bytes_range< T > | bytes (boost::endian::order InputOrder, boost::endian::order OutputOrder=boost::endian::order::native) |
Get a range of the bytes in this block. More... | |
template<typename T > | |
const_bytes_range< T > | bytes (boost::endian::order InputOrder, boost::endian::order OutputOrder=boost::endian::order::native) const |
Get a range of the bytes in this block. More... | |
template<typename T > | |
bytes_iterator< T > | bytes_begin () |
Get an iterator to the first byte in this block. More... | |
template<typename T > | |
const_bytes_iterator< T > | bytes_begin () const |
Get an iterator to the first byte in this block. More... | |
template<typename T > | |
bytes_iterator< T > | bytes_begin (boost::endian::order InputOrder, boost::endian::order OutputOrder=boost::endian::order::native) |
Get an iterator to the first byte in this block. More... | |
template<typename T > | |
const_bytes_iterator< T > | bytes_begin (boost::endian::order InputOrder, boost::endian::order OutputOrder=boost::endian::order::native) const |
Get an iterator to the first byte in this block. More... | |
template<typename T > | |
bytes_iterator< T > | bytes_end () |
Get an iterator past the last byte in this block. More... | |
template<typename T > | |
const_bytes_iterator< T > | bytes_end () const |
Get an iterator past the last byte in this block. More... | |
template<typename T > | |
bytes_iterator< T > | bytes_end (boost::endian::order InputOrder, boost::endian::order OutputOrder=boost::endian::order::native) |
Get an iterator past the last byte in this block. More... | |
template<typename T > | |
const_bytes_iterator< T > | bytes_end (boost::endian::order InputOrder, boost::endian::order OutputOrder=boost::endian::order::native) const |
Get an iterator past the last byte in this block. More... | |
std::optional< Addr > | getAddress () const |
Get the address of this block, if present. See ByteInterval::getAddress for details on why this address may not be present. More... | |
ByteInterval * | getByteInterval () |
Get the ByteInterval this block belongs to. More... | |
const ByteInterval * | getByteInterval () const |
Get the ByteInterval this block belongs to. More... | |
gtirb::DecodeMode | getDecodeMode () const |
Get the decode mode from a CodeBlock. More... | |
uint64_t | getOffset () const |
Get the offset from the beginning of the ByteInterval this block belongs to. More... | |
uint64_t | getSize () const |
Get the size from a CodeBlock. More... | |
template<typename T > | |
T * | rawBytes () |
Return the raw data underlying this block's byte vector. More... | |
template<typename T > | |
const T * | rawBytes () const |
Return the raw data underlying this block's byte vector. More... | |
void | setDecodeMode (gtirb::DecodeMode DM) |
Set the decode mode of this block. More... | |
void | setSize (uint64_t S) |
Set the size of this block. More... | |
Public Member Functions inherited from gtirb::Node | |
Node (const Node &)=delete | |
Copying Nodes is explicitly disabled. More... | |
Node (Node &&)=delete | |
Move-constructing Nodes is explicitly disabled. More... | |
~Node () noexcept | |
Cleans up resources no longer needed by the Node object. More... | |
const UUID & | getUUID () const |
Get the Universally Unique ID (UUID) for this . More... | |
Node & | operator= (const Node &)=delete |
Copying Nodes is explicilty disabled. More... | |
Node & | operator= (Node &&)=delete |
Move-assigning Nodes is explicilty disabled. More... | |
Static Public Member Functions | |
static CodeBlock * | Create (Context &C) |
Create an unitialized CodeBlock object. More... | |
static CodeBlock * | Create (Context &C, uint64_t Size, gtirb::DecodeMode DMode=DecodeMode::Default) |
Create a CodeBlock object. More... | |
Static Public Member Functions inherited from gtirb::Node | |
static Node * | Create (Context &C) |
Create a Node object in its default state. More... | |
static const Node * | getByUUID (const Context &C, const UUID &Uuid) |
Retrieve a node by its UUID. More... | |
static Node * | getByUUID (Context &C, const UUID &Uuid) |
Retrieve a node by its UUID. More... | |
Friends | |
class | ByteInterval |
class | Context |
class | SerializationTestHarness |
Additional Inherited Members | |
Protected Member Functions inherited from gtirb::CfgNode | |
CfgNode (Context &C, Kind Knd) | |
CfgNode (Context &C, Kind Knd, const UUID &U) | |
A basic block.
using gtirb::CodeBlock::bytes_iterator = ByteInterval::bytes_iterator<T> |
Iterator over bytes in this block.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
using gtirb::CodeBlock::bytes_range = ByteInterval::bytes_range<T> |
Range over bytes in this block.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
using gtirb::CodeBlock::const_bytes_iterator = ByteInterval::const_bytes_iterator<T> |
Const iterator over bytes in this block.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
using gtirb::CodeBlock::const_bytes_range = ByteInterval::const_bytes_range<T> |
Const range over bytes in this block.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
|
inline |
Get a range of the bytes in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
|
inline |
Get a range of the bytes in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
|
inline |
Get a range of the bytes in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
InputOrder | The endianness of the data in the block. |
OutputOrder | The endianness you wish to read out from the block. |
|
inline |
Get a range of the bytes in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
InputOrder | The endianness of the data in the block. |
OutputOrder | The endianness you wish to read out from the block. |
|
inline |
Get an iterator to the first byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
|
inline |
Get an iterator to the first byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
|
inline |
Get an iterator to the first byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
InputOrder | The endianness of the data in the block. |
OutputOrder | The endianness you wish to read out from the block. |
|
inline |
Get an iterator to the first byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
InputOrder | The endianness of the data in the block. |
OutputOrder | The endianness you wish to read out from the block. |
|
inline |
Get an iterator past the last byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
|
inline |
Get an iterator past the last byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
|
inline |
Get an iterator past the last byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
InputOrder | The endianness of the data in the block. |
OutputOrder | The endianness you wish to read out from the block. |
|
inline |
Get an iterator past the last byte in this block.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
T | The type of data stored in this block's byte vector. Must be a POD type that satisfies Boost's EndianReversible concept. |
InputOrder | The endianness of the data in the block. |
OutputOrder | The endianness you wish to read out from the block. |
|
inlinestatic |
std::optional<Addr> gtirb::CodeBlock::getAddress | ( | ) | const |
Get the address of this block, if present. See ByteInterval::getAddress for details on why this address may not be present.
|
inline |
Get the ByteInterval this block belongs to.
|
inline |
Get the ByteInterval this block belongs to.
|
inline |
Get the decode mode from a CodeBlock.
This field is used in some ISAs where it is used to differentiate between sub-ISAs; ARM and Thumb, for example.
uint64_t gtirb::CodeBlock::getOffset | ( | ) | const |
Get the offset from the beginning of the ByteInterval this block belongs to.
|
inline |
Get the size from a CodeBlock.
Use with CodeBlock::getAddress() to obtain arguments to pass to ByteMap::data() for an iterator over the contents of a CodeBlock.
|
inline |
Return the raw data underlying this block's byte vector.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
Much like std::vector::data, this function is low-level and potentially unsafe. This pointer refers to valid memory only where an iterator would be valid to point to. Modifying the size of the byte vector may invalidate this pointer. Any endian conversions will not be performed.
T | The type of data stored in this block's byte vector. Must be a POD type. |
\retrurn A pointer to raw data.
|
inline |
Return the raw data underlying this block's byte vector.
If this block is not associated with any ByteInterval, than the behavior of this function is undefined.
Much like std::vector::data, this function is low-level and potentially unsafe. This pointer refers to valid memory only where an iterator would be valid to point to. Modifying the size of the byte vector may invalidate this pointer. Any endian conversions will not be performed.
T | The type of data stored in this block's byte vector. Must be a POD type. |
\retrurn A pointer to raw data.
|
inline |
Set the decode mode of this block.
This field is used in some ISAs where it is used to differentiate between sub-ISAs; ARM and Thumb, for example.
|
inline |
Set the size of this block.
Note that this does not automatically update any ByteInterval's size, bytes, or symbolic expressions. This simply changes the extents of a block in its ByteInterval.
|
friend |
|
friend |
|
friend |