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

Main namespace for the GTIRB API. More...

Namespaces

 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...
 
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  SymAttributeSet
 A class for tracking a set of boolean flags that represent attributes for SymbolicExpressions. 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...
 
struct  SymStackConst
 Represents a symbolic operand of the form "Sym + Offset", representing an offset from a stack variable. 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 SymbolicExpression = std::variant< SymStackConst, 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 class  ByteOrder : uint8_t { Undefined = proto::ByteOrder_Undefined , Big = proto::BigEndian , Little = proto::LittleEndian }
 
enum class  ChangeStatus { Rejected , Accepted , NoChange }
 
enum class  ConditionalEdge : bool { OnFalse , OnTrue }
 Indicates whether an edge is conditional on true. More...
 
enum class  DirectEdge : bool { IsIndirect , IsDirect }
 Indicates whether an edge represents indirect control flow. More...
 
enum class  EdgeType {
  Branch , Call , Fallthrough , Return ,
  Syscall , Sysret
}
 Indicates the type of control flow transfer indicated by this edge. More...
 
enum class  FileFormat : uint8_t {
  Undefined = proto::Format_Undefined , COFF = proto::COFF , ELF = proto::ELF , PE = proto::PE ,
  IdaProDb32 = proto::IdaProDb32 , IdaProDb64 = proto::IdaProDb64 , XCOFF = proto::XCOFF , MACHO = proto::MACHO ,
  RAW = proto::RAW
}
 Identifies an exectuable file format. More...
 
enum class  ISA : uint8_t {
  Undefined = proto::ISA_Undefined , IA32 = proto::IA32 , PPC32 = proto::PPC32 , X64 = proto::X64 ,
  ARM = proto::ARM , ValidButUnsupported = proto::ValidButUnsupported , PPC64 = proto::PPC64 , ARM64 = proto::ARM64 ,
  MIPS32 = proto::MIPS32 , MIPS64 = proto::MIPS64
}
 
enum class  SectionFlag : uint8_t {
  Undefined = proto::SectionFlag::Section_Undefined , Readable = proto::SectionFlag::Readable , Writable = proto::SectionFlag::Writable , Executable = proto::SectionFlag::Executable ,
  Loaded = proto::SectionFlag::Loaded , Initialized = proto::SectionFlag::Initialized , ThreadLocal = proto::SectionFlag::ThreadLocal
}
 Idenfities the flags used for a section. More...
 
enum class  SymAttribute : uint8_t {
  Part0 = proto::SEAttributeFlag::Part0 , Part1 = proto::SEAttributeFlag::Part1 , Part2 = proto::SEAttributeFlag::Part2 , Part3 = proto::SEAttributeFlag::Part3 ,
  Adjusted = proto::SEAttributeFlag::Adjusted , GotRef = proto::SEAttributeFlag::GotRef , GotRelPC = proto::SEAttributeFlag::GotRelPC , GotRelGot = proto::SEAttributeFlag::GotRelGot ,
  AddrRelGot = proto::SEAttributeFlag::AddrRelGot , GotRelAddr = proto::SEAttributeFlag::GotRelAddr , GotPage = proto::SEAttributeFlag::GotPage , GotPageOfst = proto::SEAttributeFlag::GotPageOfst ,
  PltRef = proto::SEAttributeFlag::PltRef , Max = PltRef
}
 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...
 
GTIRB_EXPORT_API const 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<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 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 

◆ 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()

GTIRB_EXPORT_API const 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==()

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 
)