GTIRB  v2.1.0
GrammaTech Intermediate Representation for Binaries: C++ API
Namespaces | Classes | Typedefs | Enumerations | Functions
gtirb Namespace Reference

Main namespace for the GTIRB API. More...

Namespaces

 provisional_schema
 
 schema
 

Classes

class  Addr
 A special class to store an Effective Address. More...
 
class  AddrRange
 A range of addresses. More...
 
struct  auxdata_traits
 Provides type information and serialization functions for types which can be stored in AuxData. More...
 
class  AuxDataContainer
 Contains the AuxData Tables and serves as a base class. More...
 
class  ByteInterval
 A contiguous region of bytes in a binary. More...
 
class  ByteIntervalObserver
 Interface for notifying observers when the ByteInterval is modified. More...
 
class  CfgNode
 Represents the base of types that can be inserted into the CFG. More...
 
class  CodeBlock
 A basic block. More...
 
class  CodeBlockObserver
 Interface for notifying observers when a CodeBlock is modified. More...
 
class  Context
 The context under which GTIRB operations occur. More...
 
class  DataBlock
 Represents a data object, possibly symbolic. More...
 
class  DataBlockObserver
 Interface for notifying observers when a DataBlock is modified. More...
 
struct  ErrorInfo
 
class  ErrorOr
 
class  IR
 A complete internal representation consisting of Modules (Module). More...
 
struct  is_mapping
 Trait class that identifies whether T is a mapping container type. More...
 
struct  is_sequence
 Trait class that identifies whether T is a sequential container type. More...
 
class  Module
 Represents a single binary (library or executable). More...
 
class  ModuleObserver
 Interface for notifying observers when the Module is updated. More...
 
class  Node
 Represents the base of the Node class hierarchy. More...
 
class  Offset
 Describes a location inside a node (byte interval, block, etc). More...
 
class  ProxyBlock
 A placeholder that serves as the endpoint (source or target) of a CFG edge. More...
 
class  Section
 Represents a named section of the binary. More...
 
class  SectionObserver
 Interface for notifying observers when the Section is modified. More...
 
struct  SymAddrAddr
 Represents a symbolic operand of the form "(Sym1 - Sym2) / Scale + Offset". More...
 
struct  SymAddrConst
 Represents a symbolic operand of the form "Sym + Offset". More...
 
class  Symbol
 Represents a Symbol, which maps a name to an object in the IR. More...
 
class  SymbolObserver
 Interface for notifying observers when the Symbol is updated. More...
 

Typedefs

using block_iterator = cfg_node_cast_iter< CodeBlock >
 Iterator over blocks (Block). More...
 
using CFG = CfgBuilder< boost::listS, boost::listS, boost::bidirectionalS >::type
 Interprocedural control flow graph, with vertices of type Block. More...
 
using cfg_iterator = boost::indirect_iterator< cfg_node_iter_base >
 Iterator over CfgNodes (CfgNode). More...
 
using cfg_predecessors_range = boost::iterator_range< boost::transform_iterator< EdgeDescrToNodeLabel< CfgPredecessorTraits, CfgNode * >, CfgPredecessorTraits::edge_iterator > >
 iterator_range over a CfgNode's predecessors, non-const version More...
 
using cfg_successors_range = boost::iterator_range< boost::transform_iterator< EdgeDescrToNodeLabel< CfgSuccessorTraits, CfgNode * >, CfgSuccessorTraits::edge_iterator > >
 iterator_range over a CfgNode's successors, non-const version More...
 
using const_block_iterator = cfg_node_cast_iter< const CodeBlock >
 Constant iterator over blocks (Block). More...
 
using const_cfg_iterator = boost::indirect_iterator< cfg_node_iter_base, const CfgNode >
 Const iterator over CfgNodes (CfgNode). More...
 
using const_cfg_predecessors_range = boost::iterator_range< boost::transform_iterator< EdgeDescrToNodeLabel< CfgPredecessorTraits, const CfgNode * >, CfgPredecessorTraits::edge_iterator > >
 iterator_range over a CfgNode's predecessors, const version More...
 
using const_cfg_successors_range = boost::iterator_range< boost::transform_iterator< EdgeDescrToNodeLabel< CfgSuccessorTraits, const CfgNode * >, CfgSuccessorTraits::edge_iterator > >
 iterator_range over a CfgNode's successors, const version More...
 
using EdgeLabel = std::optional< std::tuple< ConditionalEdge, DirectEdge, EdgeType > >
 A label on a CFG edge. More...
 
using SymAttributeSet = std::set< SymAttribute >
 
using SymbolicExpression = std::variant< SymAddrConst, SymAddrAddr >
 A symbolic expression. More...
 
using UUID = boost::uuids::uuid
 Represents a universally unique identifier used to identify Node objects across serialization boundaries. More...
 

Enumerations

enum  ByteOrder : uint8_t { ByteOrder::Undefined = proto::ByteOrder_Undefined, ByteOrder::Big = proto::BigEndian, ByteOrder::Little = proto::LittleEndian }
 
enum  ChangeStatus { ChangeStatus::Rejected, ChangeStatus::Accepted, ChangeStatus::NoChange }
 
enum  ConditionalEdge : bool { ConditionalEdge::OnFalse, ConditionalEdge::OnTrue }
 Indicates whether an edge is conditional on true. More...
 
enum  DecodeMode : uint8_t { DecodeMode::Default = proto::All_Default, DecodeMode::Thumb = proto::ARM_Thumb }
 Variations on decoding a particular ISA. More...
 
enum  DirectEdge : bool { DirectEdge::IsIndirect, DirectEdge::IsDirect }
 Indicates whether an edge represents indirect control flow. More...
 
enum  EdgeType {
  EdgeType::Branch, EdgeType::Call, EdgeType::Fallthrough, EdgeType::Return,
  EdgeType::Syscall, EdgeType::Sysret
}
 Indicates the type of control flow transfer indicated by this edge. More...
 
enum  FileFormat : uint8_t {
  FileFormat::Undefined = proto::Format_Undefined, FileFormat::COFF = proto::COFF, FileFormat::ELF = proto::ELF, FileFormat::PE = proto::PE,
  FileFormat::IdaProDb32 = proto::IdaProDb32, FileFormat::IdaProDb64 = proto::IdaProDb64, FileFormat::XCOFF = proto::XCOFF, FileFormat::MACHO = proto::MACHO,
  FileFormat::RAW = proto::RAW
}
 Identifies an exectuable file format. More...
 
enum  ISA : uint8_t {
  ISA::Undefined = proto::ISA_Undefined, ISA::IA32 = proto::IA32, ISA::PPC32 = proto::PPC32, ISA::X64 = proto::X64,
  ISA::ARM = proto::ARM, ISA::ValidButUnsupported = proto::ValidButUnsupported, ISA::PPC64 = proto::PPC64, ISA::ARM64 = proto::ARM64,
  ISA::MIPS32 = proto::MIPS32, ISA::MIPS64 = proto::MIPS64
}
 
enum  SectionFlag : uint8_t {
  SectionFlag::Undefined = proto::SectionFlag::Section_Undefined, SectionFlag::Readable = proto::SectionFlag::Readable, SectionFlag::Writable = proto::SectionFlag::Writable, SectionFlag::Executable = proto::SectionFlag::Executable,
  SectionFlag::Loaded = proto::SectionFlag::Loaded, SectionFlag::Initialized = proto::SectionFlag::Initialized, SectionFlag::ThreadLocal = proto::SectionFlag::ThreadLocal
}
 Idenfities the flags used for a section. More...
 
enum  SymAttribute : uint16_t {
  SymAttribute::GOT = proto::SymAttribute::GOT, SymAttribute::GOTPC = proto::SymAttribute::GOTPC, SymAttribute::GOTOFF = proto::SymAttribute::GOTOFF, SymAttribute::GOTREL = proto::SymAttribute::GOTREL,
  SymAttribute::PLT = proto::SymAttribute::PLT, SymAttribute::PLTOFF = proto::SymAttribute::PLTOFF, SymAttribute::PCREL = proto::SymAttribute::PCREL, SymAttribute::SECREL = proto::SymAttribute::SECREL,
  SymAttribute::TLS = proto::SymAttribute::TLS, SymAttribute::TLSGD = proto::SymAttribute::TLSGD, SymAttribute::TLSLD = proto::SymAttribute::TLSLD, SymAttribute::TLSLDM = proto::SymAttribute::TLSLDM,
  SymAttribute::TLSCALL = proto::SymAttribute::TLSCALL, SymAttribute::TLSDESC = proto::SymAttribute::TLSDESC, SymAttribute::TPREL = proto::SymAttribute::TPREL, SymAttribute::TPOFF = proto::SymAttribute::TPOFF,
  SymAttribute::DTPREL = proto::SymAttribute::DTPREL, SymAttribute::DTPOFF = proto::SymAttribute::DTPOFF, SymAttribute::DTPMOD = proto::SymAttribute::DTPMOD, SymAttribute::NTPOFF = proto::SymAttribute::NTPOFF,
  SymAttribute::PAGE = proto::SymAttribute::PAGE, SymAttribute::PAGEOFF = proto::SymAttribute::PAGEOFF, SymAttribute::CALL = proto::SymAttribute::CALL, SymAttribute::LO = proto::SymAttribute::LO,
  SymAttribute::HI = proto::SymAttribute::HI, SymAttribute::HIGHER = proto::SymAttribute::HIGHER, SymAttribute::HIGHEST = proto::SymAttribute::HIGHEST, SymAttribute::GOTNTPOFF = proto::SymAttribute::GOTNTPOFF,
  SymAttribute::INDNTPOFF = proto::SymAttribute::INDNTPOFF, SymAttribute::G0 = proto::SymAttribute::G0, SymAttribute::G1 = proto::SymAttribute::G1, SymAttribute::G2 = proto::SymAttribute::G2,
  SymAttribute::G3 = proto::SymAttribute::G3, SymAttribute::UPPER16 = proto::SymAttribute::UPPER16, SymAttribute::LOWER16 = proto::SymAttribute::LOWER16, SymAttribute::LO12 = proto::SymAttribute::LO12,
  SymAttribute::LO15 = proto::SymAttribute::LO15, SymAttribute::LO14 = proto::SymAttribute::LO14, SymAttribute::HI12 = proto::SymAttribute::HI12, SymAttribute::HI21 = proto::SymAttribute::HI21,
  SymAttribute::S = proto::SymAttribute::S, SymAttribute::PG = proto::SymAttribute::PG, SymAttribute::NC = proto::SymAttribute::NC, SymAttribute::ABS = proto::SymAttribute::ABS,
  SymAttribute::PREL = proto::SymAttribute::PREL, SymAttribute::PREL31 = proto::SymAttribute::PREL31, SymAttribute::TARGET1 = proto::SymAttribute::TARGET1, SymAttribute::TARGET2 = proto::SymAttribute::TARGET2,
  SymAttribute::SBREL = proto::SymAttribute::SBREL, SymAttribute::TLSLDO = proto::SymAttribute::TLSLDO, SymAttribute::HI16 = proto::SymAttribute::HI16, SymAttribute::LO16 = proto::SymAttribute::LO16,
  SymAttribute::GPREL = proto::SymAttribute::GPREL, SymAttribute::DISP = proto::SymAttribute::DISP, SymAttribute::OFST = proto::SymAttribute::OFST, SymAttribute::H = proto::SymAttribute::H,
  SymAttribute::L = proto::SymAttribute::L, SymAttribute::HA = proto::SymAttribute::HA, SymAttribute::HIGH = proto::SymAttribute::HIGH, SymAttribute::HIGHA = proto::SymAttribute::HIGHA,
  SymAttribute::HIGHERA = proto::SymAttribute::HIGHERA, SymAttribute::HIGHESTA = proto::SymAttribute::HIGHESTA, SymAttribute::TOCBASE = proto::SymAttribute::TOCBASE, SymAttribute::TOC = proto::SymAttribute::TOC,
  SymAttribute::NOTOC = proto::SymAttribute::NOTOC
}
 The space of attributes that can be applied to a symbolic expression. More...
 

Functions

GTIRB_EXPORT_API std::optional< CFG::edge_descriptor > addEdge (const CfgNode *From, const CfgNode *To, CFG &Cfg)
 Create a new edge between two CFG nodes if they exist in the graph. More...
 
GTIRB_EXPORT_API std::pair< CFG::vertex_descriptor, bool > addVertex (CfgNode *B, CFG &Cfg)
 Add a node to the CFG. More...
 
template<>
std::optional< uint64_t > asOptionalSize (std::optional< uint64_t > X)
 
template<typename T >
std::optional< uint64_t > asOptionalSize (T X)
 
template<>
std::optional< uint64_t > asOptionalSize (uint64_t X)
 
gtirb::AuxDataContainer Node AuxDataContainer (Context &C, Kind knd)
 
 AuxDataContainer (Context &C, Kind knd, const UUID &U)
 
GTIRB_EXPORT_API boost::iterator_range< block_iteratorblocks (CFG &Cfg)
 Get a range of just the Block elements in the specified graph. More...
 
GTIRB_EXPORT_API boost::iterator_range< const_block_iteratorblocks (const CFG &Cfg)
 Get a constant range of just the Block elements in the specified graph. More...
 
cfg_predecessors_range cfgPredecessors (CFG &G, const CfgNode *N)
 Returns an iterator_range to iterate the predecessors of a CfgNode. More...
 
const_cfg_predecessors_range cfgPredecessors (const CFG &G, const CfgNode *N)
 
cfg_successors_range cfgSuccessors (CFG &G, const CfgNode *N)
 Returns an iterator_range to iterate the successors of a CfgNode. More...
 
const_cfg_successors_range cfgSuccessors (const CFG &G, const CfgNode *N)
 
GTIRB_EXPORT_API std::optional< CFG::vertex_descriptor > getVertex (const CfgNode *N, const CFG &Cfg)
 Get the boost::graph vertex descriptor for a CfgNode if it is in the graph. More...
 
const GTIRB_EXPORT_API std::error_category & loadErrorCategory ()
 The error category used to represent load failures. More...
 
std::error_code make_error_code (gtirb::IR::load_error e)
 Makes an std::error_code object from an IR::load_error object. More...
 
GTIRB_EXPORT_API boost::iterator_range< cfg_iteratornodes (CFG &Cfg)
 Get a range of the CfgNode elements in the specified graph. More...
 
GTIRB_EXPORT_API boost::iterator_range< const_cfg_iteratornodes (const CFG &Cfg)
 Get a constant range of the CfgNode elements in the specified graph. More...
 
template<typename CharT , typename Traits >
std::ostream & operator<< (std::basic_ostream< CharT, Traits > &os, const ErrorInfo &Info)
 
GTIRB_EXPORT_API std::ostream & operator<< (std::ostream &OS, const ConditionalEdge &CE)
 
GTIRB_EXPORT_API std::ostream & operator<< (std::ostream &OS, const DirectEdge &DE)
 
GTIRB_EXPORT_API std::ostream & operator<< (std::ostream &OS, const EdgeLabel &Label)
 
GTIRB_EXPORT_API std::ostream & operator<< (std::ostream &OS, const EdgeType &ET)
 
template<class T , class E >
std::enable_if_t< std::is_error_code_enum< E >::value||std::is_error_condition_enum< E >::value, bool > operator== (const ErrorOr< T > &Err, E Code)
 
GTIRB_EXPORT_API bool removeEdge (const CfgNode *From, const CfgNode *To, CFG &Cfg)
 Remove all edges between the source and target nodes from the CFG. More...
 
GTIRB_EXPORT_API bool removeEdge (const CfgNode *From, const CfgNode *To, EdgeLabel Label, CFG &Cfg)
 Remove all edges with given label between the source and target nodes from the CFG. More...
 
GTIRB_EXPORT_API bool removeVertex (CfgNode *N, CFG &Cfg)
 Remove a node from the CFG. More...
 

Detailed Description

Main namespace for the GTIRB API.

Typedef Documentation

◆ cfg_predecessors_range

using gtirb::cfg_predecessors_range = typedef boost::iterator_range<boost::transform_iterator< EdgeDescrToNodeLabel<CfgPredecessorTraits, CfgNode*>, CfgPredecessorTraits::edge_iterator> >

iterator_range over a CfgNode's predecessors, non-const version

◆ cfg_successors_range

using gtirb::cfg_successors_range = typedef boost::iterator_range<boost::transform_iterator< EdgeDescrToNodeLabel<CfgSuccessorTraits, CfgNode*>, CfgSuccessorTraits::edge_iterator> >

iterator_range over a CfgNode's successors, non-const version

◆ const_cfg_predecessors_range

using gtirb::const_cfg_predecessors_range = typedef boost::iterator_range<boost::transform_iterator< EdgeDescrToNodeLabel<CfgPredecessorTraits, const CfgNode*>, CfgPredecessorTraits::edge_iterator> >

iterator_range over a CfgNode's predecessors, const version

◆ const_cfg_successors_range

using gtirb::const_cfg_successors_range = typedef boost::iterator_range<boost::transform_iterator< EdgeDescrToNodeLabel<CfgSuccessorTraits, const CfgNode*>, CfgSuccessorTraits::edge_iterator> >

iterator_range over a CfgNode's successors, const version

◆ UUID

using gtirb::UUID = typedef boost::uuids::uuid

Represents a universally unique identifier used to identify Node objects across serialization boundaries.

See also
Node
Context

Enumeration Type Documentation

◆ ByteOrder

enum gtirb::ByteOrder : uint8_t
strong
Enumerator
Undefined 

Unknown or uninitialized endianness.

Big 

Big endian.

Little 

Little endian.

◆ ChangeStatus

enum gtirb::ChangeStatus
strong
Enumerator
Rejected 
Accepted 
NoChange 

◆ DecodeMode

enum gtirb::DecodeMode : uint8_t
strong

Variations on decoding a particular ISA.

Enumerator
Default 

Default decode mode for all ISAs.

Thumb 

Thumb decode mode for ARM32.

◆ FileFormat

enum gtirb::FileFormat : uint8_t
strong

Identifies an exectuable file format.

Enumerator
Undefined 

Default value indicates an uninitialized state.

COFF 

Common Object File Format (COFF)

ELF 

Executable and Linkable Format (ELF, formerly named Extensible Linking Format)

PE 

Microsoft Portable Executable (PE) format.

IdaProDb32 

IDA Pro database file.

IdaProDb64 

IDA Pro database file.

XCOFF 

Non-COFF (files start with ANON_OBJECT_HEADER*)

MACHO 

Mach object file format.

RAW 

Raw binary file (no format)

◆ ISA

enum gtirb::ISA : uint8_t
strong
Enumerator
Undefined 

Default value to indicates an uninitialized state.

IA32 

Intel Architecture, 32-bit. Also known as i386.

PPC32 

Performance Optimization With Enhanced RISC – Performance Computing, 32-bit.

X64 

The generic name for the 64-bit extensions to both Intel's and AMD's 32-bit x86 instruction set architecture (ISA).

ARM 

Advanced RISC Machine, also known as Acorn RISC Machine, 32-bit.

ValidButUnsupported 
PPC64 

Performance Optimization With Enhanced RISC – Performance Computing, 64-bit.

ARM64 

Advanced RISC Machine, also known as Acorn RISC Machine, 64-bit.

MIPS32 

Microprocessor without Interlocked Pipelined Stages, 32-bit.

MIPS64 

Microprocessor without Interlocked Pipelined Stages, 64-bit.

◆ SectionFlag

enum gtirb::SectionFlag : uint8_t
strong

Idenfities the flags used for a section.

Enumerator
Undefined 
Readable 
Writable 
Executable 
Loaded 
Initialized 
ThreadLocal 

Function Documentation

◆ asOptionalSize() [1/3]

template<>
std::optional<uint64_t> gtirb::asOptionalSize ( std::optional< uint64_t >  X)
inline

◆ asOptionalSize() [2/3]

template<typename T >
std::optional<uint64_t> gtirb::asOptionalSize ( X)

◆ asOptionalSize() [3/3]

template<>
std::optional<uint64_t> gtirb::asOptionalSize ( uint64_t  X)
inline

◆ AuxDataContainer() [1/2]

◆ AuxDataContainer() [2/2]

gtirb::AuxDataContainer ( Context C,
Kind  knd,
const UUID U 
)

◆ cfgPredecessors()

const_cfg_predecessors_range gtirb::cfgPredecessors ( const CFG G,
const CfgNode N 
)
inline

◆ cfgSuccessors()

const_cfg_successors_range gtirb::cfgSuccessors ( const CFG G,
const CfgNode N 
)
inline

◆ loadErrorCategory()

const GTIRB_EXPORT_API std::error_category& gtirb::loadErrorCategory ( )

The error category used to represent load failures.

Returns
The load failure error category.

◆ make_error_code()

std::error_code gtirb::make_error_code ( gtirb::IR::load_error  e)
inline

Makes an std::error_code object from an IR::load_error object.

Returns
The error code.

◆ operator<<() [1/5]

template<typename CharT , typename Traits >
std::ostream& gtirb::operator<< ( std::basic_ostream< CharT, Traits > &  os,
const ErrorInfo Info 
)

◆ operator<<() [2/5]

GTIRB_EXPORT_API std::ostream& gtirb::operator<< ( std::ostream &  OS,
const ConditionalEdge CE 
)

◆ operator<<() [3/5]

GTIRB_EXPORT_API std::ostream& gtirb::operator<< ( std::ostream &  OS,
const DirectEdge DE 
)

◆ operator<<() [4/5]

GTIRB_EXPORT_API std::ostream& gtirb::operator<< ( std::ostream &  OS,
const EdgeLabel Label 
)

◆ operator<<() [5/5]

GTIRB_EXPORT_API std::ostream& gtirb::operator<< ( std::ostream &  OS,
const EdgeType ET 
)

◆ operator==()

template<class T , class E >
std::enable_if_t<std::is_error_code_enum<E>::value || std::is_error_condition_enum<E>::value, bool> gtirb::operator== ( const ErrorOr< T > &  Err,
Code 
)