LLVM 22.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
llvm::DWARFDebugLine::LineTable Struct Reference

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

Public Types

using RowVector = std::vector< Row >
 
using RowIter = RowVector::const_iterator
 
using SequenceVector = std::vector< Sequence >
 
using SequenceIter = SequenceVector::const_iterator
 

Public Member Functions

LLVM_ABI LineTable ()
 
void appendRow (const DWARFDebugLine::Row &R)
 
void appendSequence (const DWARFDebugLine::Sequence &S)
 
LLVM_ABI uint32_t lookupAddress (object::SectionedAddress Address, bool *IsApproximateLine=nullptr) const
 Returns the index of the row with file/line info for a given address, or UnknownRowIndex if there is no such row.
 
LLVM_ABI bool lookupAddressRange (object::SectionedAddress Address, uint64_t Size, std::vector< uint32_t > &Result, std::optional< uint64_t > StmtSequenceOffset=std::nullopt) const
 Fills the Result argument with the indices of the rows that correspond to the address range specified by Address and Size.
 
bool hasFileAtIndex (uint64_t FileIndex) const
 
std::optional< uint64_tgetLastValidFileIndex () const
 
bool getFileNameByIndex (uint64_t FileIndex, StringRef CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, std::string &Result) const
 Extracts filename by its index in filename table in prologue.
 
LLVM_ABI bool getFileLineInfoForAddress (object::SectionedAddress Address, bool Approximate, const char *CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, DILineInfo &Result) const
 Fills the Result argument with the file and line information corresponding to Address.
 
LLVM_ABI bool getDirectoryForEntry (const FileNameEntry &Entry, std::string &Directory) const
 Extracts directory name by its Entry in include directories table in prologue.
 
LLVM_ABI void dump (raw_ostream &OS, DIDumpOptions DumpOptions) const
 
LLVM_ABI void clear ()
 
LLVM_ABI Error parse (DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, const DWARFContext &Ctx, const DWARFUnit *U, function_ref< void(Error)> RecoverableErrorHandler, raw_ostream *OS=nullptr, bool Verbose=false)
 Parse prologue and all rows.
 

Public Attributes

const uint32_t UnknownRowIndex = UINT32_MAX
 Represents an invalid row.
 
struct Prologue Prologue
 
RowVector Rows
 
SequenceVector Sequences
 

Detailed Description

Definition at line 233 of file DWARFDebugLine.h.

Member Typedef Documentation

◆ RowIter

using llvm::DWARFDebugLine::LineTable::RowIter = RowVector::const_iterator

Definition at line 305 of file DWARFDebugLine.h.

◆ RowVector

Definition at line 304 of file DWARFDebugLine.h.

◆ SequenceIter

using llvm::DWARFDebugLine::LineTable::SequenceIter = SequenceVector::const_iterator

Definition at line 307 of file DWARFDebugLine.h.

◆ SequenceVector

Definition at line 306 of file DWARFDebugLine.h.

Constructor & Destructor Documentation

◆ LineTable()

DWARFDebugLine::LineTable::LineTable ( )

Definition at line 537 of file DWARFDebugLine.cpp.

Member Function Documentation

◆ appendRow()

void llvm::DWARFDebugLine::LineTable::appendRow ( const DWARFDebugLine::Row R)
inline

Definition at line 239 of file DWARFDebugLine.h.

References Rows.

◆ appendSequence()

void llvm::DWARFDebugLine::LineTable::appendSequence ( const DWARFDebugLine::Sequence S)
inline

Definition at line 241 of file DWARFDebugLine.h.

References Sequences.

◆ clear()

void DWARFDebugLine::LineTable::clear ( )

Definition at line 556 of file DWARFDebugLine.cpp.

References llvm::DWARFDebugLine::Prologue::clear().

◆ dump()

void DWARFDebugLine::LineTable::dump ( raw_ostream OS,
DIDumpOptions  DumpOptions 
) const

◆ getDirectoryForEntry()

bool DWARFDebugLine::LineTable::getDirectoryForEntry ( const FileNameEntry Entry,
std::string &  Directory 
) const

Extracts directory name by its Entry in include directories table in prologue.

Returns true on success.

Definition at line 1551 of file DWARFDebugLine.cpp.

References llvm::DWARFDebugLine::Prologue::getVersion(), llvm::DWARFDebugLine::Prologue::IncludeDirectories, and llvm::dwarf::toString().

◆ getFileLineInfoForAddress()

bool DWARFDebugLine::LineTable::getFileLineInfoForAddress ( object::SectionedAddress  Address,
bool  Approximate,
const char CompDir,
DILineInfoSpecifier::FileLineInfoKind  Kind,
DILineInfo Result 
) const

Fills the Result argument with the file and line information corresponding to Address.

Returns true on success.

Definition at line 1532 of file DWARFDebugLine.cpp.

References llvm::Address, llvm::DWARFDebugLine::Row::Column, llvm::DWARFDebugLine::Row::Discriminator, llvm::DWARFDebugLine::Row::File, and llvm::DWARFDebugLine::Row::Line.

Referenced by llvm::DWARFContext::getInliningInfoForAddress().

◆ getFileNameByIndex()

bool llvm::DWARFDebugLine::LineTable::getFileNameByIndex ( uint64_t  FileIndex,
StringRef  CompDir,
DILineInfoSpecifier::FileLineInfoKind  Kind,
std::string &  Result 
) const
inline

Extracts filename by its index in filename table in prologue.

In Dwarf 4, the files are 1-indexed and the current compilation file name is not represented in the list. In DWARF v5, the files are 0-indexed and the primary source file has the index 0. Returns true on success.

Definition at line 278 of file DWARFDebugLine.h.

References llvm::DWARFDebugLine::Prologue::getFileNameByIndex().

Referenced by llvm::dwarf_linker::parallel::CompileUnit::getFileName(), llvm::DWARFContext::getInliningInfoForAddress(), and llvm::DWARFContext::getLineInfoForAddressRange().

◆ getLastValidFileIndex()

std::optional< uint64_t > llvm::DWARFDebugLine::LineTable::getLastValidFileIndex ( ) const
inline

◆ hasFileAtIndex()

bool llvm::DWARFDebugLine::LineTable::hasFileAtIndex ( uint64_t  FileIndex) const
inline

◆ lookupAddress()

uint32_t DWARFDebugLine::LineTable::lookupAddress ( object::SectionedAddress  Address,
bool IsApproximateLine = nullptr 
) const

Returns the index of the row with file/line info for a given address, or UnknownRowIndex if there is no such row.

Definition at line 1323 of file DWARFDebugLine.cpp.

References llvm::Address, and llvm::object::SectionedAddress::UndefSection.

◆ lookupAddressRange()

bool DWARFDebugLine::LineTable::lookupAddressRange ( object::SectionedAddress  Address,
uint64_t  Size,
std::vector< uint32_t > &  Result,
std::optional< uint64_t StmtSequenceOffset = std::nullopt 
) const

Fills the Result argument with the indices of the rows that correspond to the address range specified by Address and Size.

Parameters
Address- The starting address of the range.
Size- The size of the address range.
Result- The vector to fill with row indices.
StmtSequenceOffset- if provided, only rows from the sequence starting at the matching offset will be added to the result.

Returns true if any rows were found.

Definition at line 1372 of file DWARFDebugLine.cpp.

References llvm::Address, Size, and llvm::object::SectionedAddress::UndefSection.

Referenced by convertFunctionLineTable(), and llvm::DWARFContext::getLineInfoForAddressRange().

◆ parse()

Error DWARFDebugLine::LineTable::parse ( DWARFDataExtractor DebugLineData,
uint64_t OffsetPtr,
const DWARFContext Ctx,
const DWARFUnit U,
function_ref< void(Error)>  RecoverableErrorHandler,
raw_ostream OS = nullptr,
bool  Verbose = false 
)

Parse prologue and all rows.

Definition at line 789 of file DWARFDebugLine.cpp.

References llvm::DWARFDebugLine::ParsingState::OpcodeAdvanceResults::AddrDelta, llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta::Address, llvm::DWARFDebugLine::ParsingState::AddrOpIndexDelta::AddrOffset, assert(), llvm::dwarf::computeTombstoneAddress(), llvm::consumeError(), llvm::DWARFFormValue::createFromPValue(), llvm::createStringError(), llvm::DWARFDebugLine::FileNameEntry::DirIdx, llvm::DWARFDebugLine::Prologue::dump(), llvm::DWARFFormValue::dumpAddress(), llvm::DWARFDebugLine::Row::dumpTableHeader(), End, llvm::DWARFDebugLine::Prologue::FileNames, llvm::First, llvm::format(), llvm::DWARFDebugLine::Prologue::getAddressSize(), llvm::DataExtractor::getAddressSize(), llvm::DataExtractor::getCStr(), llvm::DWARFDebugLine::Prologue::getLength(), llvm::DWARFDataExtractorBase< Relocator >::getRelocatedAddress(), llvm::DWARFDataExtractorBase< Relocator >::getRelocatedValue(), llvm::DataExtractor::getSLEB128(), llvm::DataExtractor::getU8(), llvm::DataExtractor::getULEB128(), I, llvm::illegal_byte_sequence, llvm::raw_ostream::indent(), llvm::invalid_argument, llvm::DataExtractor::isValidOffsetForDataOfSize(), llvm::DWARFDebugLine::FileNameEntry::Length, llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta::Line, llvm::dwarf::LNExtendedString(), llvm::dwarf::LNStandardString(), llvm::DWARFDebugLine::FileNameEntry::ModTime, llvm::DWARFDebugLine::FileNameEntry::Name, Name, llvm::DWARFDebugLine::Prologue::OpcodeBase, Operands, llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta::OpIndex, llvm::DWARFDebugLine::ParsingState::AddrOpIndexDelta::OpIndexDelta, llvm::DWARFDebugLine::ParsingState::OpcodeAdvanceResults::OpIndexDelta, llvm::DWARFDebugLine::Sequence::orderByHighPC(), OS, llvm::DWARFDebugLine::Prologue::parse(), llvm::DataExtractor::setAddressSize(), llvm::DataExtractor::size(), llvm::DWARFDebugLine::Prologue::sizeofTotalLength(), llvm::DataExtractor::skip(), llvm::stable_sort(), llvm::DWARFDebugLine::Prologue::StandardOpcodeLengths, llvm::Error::success(), llvm::DataExtractor::Cursor::takeError(), llvm::DataExtractor::Cursor::tell(), llvm::DWARFDebugLine::Prologue::TotalLength, llvm::Verbose, and llvm::DIDumpOptions::Verbose.

Member Data Documentation

◆ Prologue

struct Prologue llvm::DWARFDebugLine::LineTable::Prologue

◆ Rows

RowVector llvm::DWARFDebugLine::LineTable::Rows

◆ Sequences

SequenceVector llvm::DWARFDebugLine::LineTable::Sequences

◆ UnknownRowIndex

const uint32_t llvm::DWARFDebugLine::LineTable::UnknownRowIndex = UINT32_MAX

Represents an invalid row.

Definition at line 237 of file DWARFDebugLine.h.


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