LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
llvm::dwarf::CFIProgram Class Reference

Represent a sequence of Call Frame Information instructions that, when read in order, construct a table mapping PC to frame state. More...

#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"

Classes

struct  Instruction
 An instruction consists of a DWARF CFI opcode and an optional sequence of operands. More...
 

Public Types

typedef SmallVector< uint64_t, MaxOperandsOperands
 
using InstrList = std::vector< Instruction >
 
using iterator = InstrList::iterator
 
using const_iterator = InstrList::const_iterator
 

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
unsigned size () const
 
bool empty () const
 
uint64_t codeAlign () const
 
int64_t dataAlign () const
 
Triple::ArchType triple () const
 
 CFIProgram (uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor, Triple::ArchType Arch)
 
Error parse (DWARFDataExtractor Data, uint64_t *Offset, uint64_t EndOffset)
 Parse and store a sequence of CFI instructions from Data, starting at *Offset and ending at EndOffset.
 
void dump (raw_ostream &OS, DIDumpOptions DumpOpts, unsigned IndentLevel, std::optional< uint64_t > InitialLocation) const
 
void addInstruction (const Instruction &I)
 
StringRef callFrameString (unsigned Opcode) const
 Get a DWARF CFI call frame string for the given DW_CFA opcode.
 

Static Public Attributes

static constexpr size_t MaxOperands = 3
 

Detailed Description

Represent a sequence of Call Frame Information instructions that, when read in order, construct a table mapping PC to frame state.

This can also be referred to as "CFI rules" in DWARF literature to avoid confusion with computer programs in the broader sense, and in this context each instruction would be a rule to establish the mapping. Refer to pg. 172 in the DWARF5 manual, "6.4.1 Structure of Call Frame Information".

Definition at line 407 of file DWARFDebugFrame.h.

Member Typedef Documentation

◆ const_iterator

using llvm::dwarf::CFIProgram::const_iterator = InstrList::const_iterator

Definition at line 432 of file DWARFDebugFrame.h.

◆ InstrList

Definition at line 430 of file DWARFDebugFrame.h.

◆ iterator

using llvm::dwarf::CFIProgram::iterator = InstrList::iterator

Definition at line 431 of file DWARFDebugFrame.h.

◆ Operands

Definition at line 410 of file DWARFDebugFrame.h.

Constructor & Destructor Documentation

◆ CFIProgram()

llvm::dwarf::CFIProgram::CFIProgram ( uint64_t  CodeAlignmentFactor,
int64_t  DataAlignmentFactor,
Triple::ArchType  Arch 
)
inline

Definition at line 445 of file DWARFDebugFrame.h.

Member Function Documentation

◆ addInstruction()

void llvm::dwarf::CFIProgram::addInstruction ( const Instruction I)
inline

Definition at line 460 of file DWARFDebugFrame.h.

References I.

Referenced by parse().

◆ begin() [1/2]

iterator llvm::dwarf::CFIProgram::begin ( )
inline

Definition at line 434 of file DWARFDebugFrame.h.

◆ begin() [2/2]

const_iterator llvm::dwarf::CFIProgram::begin ( ) const
inline

Definition at line 435 of file DWARFDebugFrame.h.

◆ callFrameString()

StringRef CFIProgram::callFrameString ( unsigned  Opcode) const

Get a DWARF CFI call frame string for the given DW_CFA opcode.

Definition at line 393 of file DWARFDebugFrame.cpp.

References llvm::dwarf::CallFrameString().

Referenced by dump().

◆ codeAlign()

uint64_t llvm::dwarf::CFIProgram::codeAlign ( ) const
inline

◆ dataAlign()

int64_t llvm::dwarf::CFIProgram::dataAlign ( ) const
inline

◆ dump()

void CFIProgram::dump ( raw_ostream OS,
DIDumpOptions  DumpOpts,
unsigned  IndentLevel,
std::optional< uint64_t InitialLocation 
) const

Definition at line 928 of file DWARFDebugFrame.cpp.

References llvm::Address, callFrameString(), llvm::raw_ostream::indent(), and OS.

◆ empty()

bool llvm::dwarf::CFIProgram::empty ( ) const
inline

Definition at line 440 of file DWARFDebugFrame.h.

Referenced by llvm::dwarf::UnwindTable::create().

◆ end() [1/2]

iterator llvm::dwarf::CFIProgram::end ( )
inline

Definition at line 436 of file DWARFDebugFrame.h.

◆ end() [2/2]

const_iterator llvm::dwarf::CFIProgram::end ( ) const
inline

Definition at line 437 of file DWARFDebugFrame.h.

◆ parse()

Error CFIProgram::parse ( DWARFDataExtractor  Data,
uint64_t Offset,
uint64_t  EndOffset 
)

Parse and store a sequence of CFI instructions from Data, starting at *Offset and ending at EndOffset.

*Offset is updated to EndOffset upon successful parsing, or indicates the offset where a problem occurred in case an error is returned.

Definition at line 255 of file DWARFDebugFrame.cpp.

References addInstruction(), llvm::CallingConv::C, llvm::createStringError(), llvm::Data, DWARF_CFI_PRIMARY_OPCODE_MASK, DWARF_CFI_PRIMARY_OPERAND_MASK, llvm::illegal_byte_sequence, llvm_unreachable, and llvm::Offset.

◆ size()

unsigned llvm::dwarf::CFIProgram::size ( ) const
inline

Definition at line 439 of file DWARFDebugFrame.h.

◆ triple()

Triple::ArchType llvm::dwarf::CFIProgram::triple ( ) const
inline

Definition at line 443 of file DWARFDebugFrame.h.

Member Data Documentation

◆ MaxOperands

constexpr size_t llvm::dwarf::CFIProgram::MaxOperands = 3
staticconstexpr

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