LLVM 22.0.0git
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.

References clear().

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 Prologue, Rows, and Sequences.

Referenced by LineTable(), and parse().

◆ dump()

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

Definition at line 539 of file DWARFDebugLine.cpp.

References llvm::DWARFDebugLine::Row::dumpTableHeader(), Prologue, and Rows.

◆ 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 Prologue, 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, getFileNameByIndex(), llvm::DWARFDebugLine::Row::Line, lookupAddress(), and Rows.

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 Prologue.

Referenced by getFileLineInfoForAddress(), llvm::DWARFContext::getInliningInfoForAddress(), and llvm::DWARFContext::getLineInfoForAddressRange().

◆ getLastValidFileIndex()

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

Definition at line 269 of file DWARFDebugLine.h.

References Prologue.

◆ hasFileAtIndex()

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

Definition at line 265 of file DWARFDebugLine.h.

References Prologue.

◆ 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, llvm::object::SectionedAddress::UndefSection, and UnknownRowIndex.

Referenced by getFileLineInfoForAddress().

◆ 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(), clear(), llvm::dwarf::computeTombstoneAddress(), llvm::consumeError(), llvm::DWARFFormValue::createFromPValue(), llvm::createStringError(), DenseMapInfo< LocallyHashedType >::Tombstone, llvm::DWARFDebugLine::FileNameEntry::DirIdx, llvm::DWARFFormValue::dumpAddress(), llvm::DWARFDebugLine::Row::dumpTableHeader(), llvm::First, llvm::format(), llvm::DataExtractor::getAddressSize(), llvm::DataExtractor::getCStr(), 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, Operands, llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta::OpIndex, llvm::DWARFDebugLine::ParsingState::AddrOpIndexDelta::OpIndexDelta, llvm::DWARFDebugLine::ParsingState::OpcodeAdvanceResults::OpIndexDelta, llvm::DWARFDebugLine::Sequence::orderByHighPC(), parseULEB128(), Prologue, Rows, Sequences, llvm::DataExtractor::setAddressSize(), llvm::DataExtractor::size(), llvm::DataExtractor::skip(), llvm::stable_sort(), llvm::Error::success(), llvm::DataExtractor::Cursor::takeError(), llvm::DIDumpOptions::Verbose, and llvm::Verbose.

Member Data Documentation

◆ Prologue

◆ 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.

Referenced by lookupAddress().


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