9#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLINE_H
10#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLINE_H
133 explicit Row(
bool DefaultIsStmt =
false);
137 void reset(
bool DefaultIsStmt);
143 return std::tie(
LHS.Address.SectionIndex,
LHS.Address.Address) <
144 std::tie(
RHS.Address.SectionIndex,
RHS.Address.Address);
215 return std::tie(
LHS.SectionIndex,
LHS.HighPC) <
216 std::tie(
RHS.SectionIndex,
RHS.HighPC);
244 bool *IsApproximateLine =
nullptr)
const;
247 std::vector<uint32_t> &Result)
const;
264 std::string &Result)
const {
271 bool Approximate,
const char *CompDir,
278 std::string &Directory)
const;
301 std::optional<StringRef>
302 getSourceByIndex(
uint64_t FileIndex,
306 bool *IsApproximateLine =
nullptr)
const;
309 std::vector<uint32_t> &Result)
const;
356 bool done()
const {
return Done; }
364 bool hasValidVersion(
uint64_t Offset);
375 struct ParsingState {
376 ParsingState(
struct LineTable *LT,
uint64_t TableOffset,
379 void resetRowAndSequence();
380 void appendRowToMatrix();
390 uint8_t Opcode,
uint64_t OpcodeOffset);
422 bool ReportAdvanceAddrProblem =
true;
423 bool ReportBadLineRange =
true;
427 using LineTableMapTy = std::map<uint64_t, LineTable>;
428 using LineTableIter = LineTableMapTy::iterator;
429 using LineTableConstIter = LineTableMapTy::const_iterator;
431 LineTableMapTy LineTableMap;
This file contains constants used for implementing Dwarf debug support.
static fatal_error_handler_t ErrorHandler
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Helper to allow for parsing of an entire .debug_line section in sequence.
void skip(function_ref< void(Error)> RecoverableErrorHandler, function_ref< void(Error)> UnrecoverableErrorHandler)
Skip the current line table and go to the following line table (if present) immediately.
uint64_t getOffset() const
Get the offset the parser has reached.
std::map< uint64_t, DWARFUnit * > LineToUnitMap
LineTable parseNext(function_ref< void(Error)> RecoverableErrorHandler, function_ref< void(Error)> UnrecoverableErrorHandler, raw_ostream *OS=nullptr, bool Verbose=false)
Get the next line table from the section.
bool done() const
Indicates if the parser has parsed as much as possible.
void clearLineTable(uint64_t Offset)
Expected< const LineTable * > getOrParseLineTable(DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx, const DWARFUnit *U, function_ref< void(Error)> RecoverableErrorHandler)
const LineTable * getLineTable(uint64_t Offset) const
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
Container for dump options that control which debug information will be dumped.
A format-neutral container for source line information.
Tracks which optional content types are present in a DWARF file name entry format.
bool HasLength
Whether filename entries provide a file size.
ContentTypeTracker()=default
bool HasSource
For v5, whether filename entries provide source text.
bool HasModTime
Whether filename entries provide a modification timestamp.
bool HasMD5
For v5, whether filename entries provide an MD5 checksum.
void trackContentType(dwarf::LineNumberEntryFormat ContentType)
Update tracked content types with ContentType.
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 ...
bool getDirectoryForEntry(const FileNameEntry &Entry, std::string &Directory) const
Extracts directory name by its Entry in include directories table in prologue.
const uint32_t UnknownRowIndex
Represents an invalid row.
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.
std::optional< uint64_t > getLastValidFileIndex() const
bool hasFileAtIndex(uint64_t FileIndex) 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.
RowVector::const_iterator RowIter
bool lookupAddressRange(object::SectionedAddress Address, uint64_t Size, std::vector< uint32_t > &Result) const
SequenceVector::const_iterator SequenceIter
std::vector< Row > RowVector
std::vector< Sequence > SequenceVector
void appendSequence(const DWARFDebugLine::Sequence &S)
void appendRow(const DWARFDebugLine::Row &R)
void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const
uint8_t MaxOpsPerInst
The maximum number of individual operations that may be encoded in an instruction.
uint8_t MinInstLength
The size in bytes of the smallest target machine instruction.
bool hasFileAtIndex(uint64_t FileIndex) const
uint64_t PrologueLength
The number of bytes following the prologue_length field to the beginning of the first byte of the sta...
void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const
uint32_t sizeofTotalLength() const
uint8_t SegSelectorSize
In v5, size in bytes of a segment selector.
uint16_t getVersion() const
int8_t LineBase
This parameter affects the meaning of the special opcodes. See below.
std::optional< uint64_t > getLastValidFileIndex() const
uint32_t sizeofPrologueLength() const
uint8_t LineRange
This parameter affects the meaning of the special opcodes. See below.
const dwarf::FormParams getFormParams() const
std::vector< DWARFFormValue > IncludeDirectories
uint8_t OpcodeBase
The number assigned to the first special opcode.
std::vector< uint8_t > StandardOpcodeLengths
bool totalLengthIsValid() const
uint8_t getAddressSize() const
const llvm::DWARFDebugLine::FileNameEntry & getFileNameEntry(uint64_t Index) const
Get DWARF-version aware access to the file name entry at the provided index.
bool getFileNameByIndex(uint64_t FileIndex, StringRef CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, std::string &Result, sys::path::Style Style=sys::path::Style::native) const
uint8_t DefaultIsStmt
The initial value of theis_stmtregister.
uint64_t TotalLength
The size in bytes of the statement information for this compilation unit (not including the total_len...
dwarf::FormParams FormParams
Version, address size (starting in v5), and DWARF32/64 format; these parameters affect interpretation...
uint64_t getLength() const
Length of the prologue in bytes.
ContentTypeTracker ContentTypes
This tracks which optional file format content types are present.
std::vector< FileNameEntry > FileNames
Standard .debug_line state machine structure.
uint8_t BasicBlock
A boolean indicating that the current instruction is the beginning of a basic block.
static bool orderByAddress(const Row &LHS, const Row &RHS)
uint32_t Line
An unsigned integer indicating a source line number.
uint16_t File
An unsigned integer indicating the identity of the source file corresponding to a machine instruction...
uint32_t Discriminator
An unsigned integer representing the DWARF path discriminator value for this location.
uint8_t EpilogueBegin
A boolean indicating that the current address is one (of possibly many) where execution should be sus...
object::SectionedAddress Address
The program-counter value corresponding to a machine instruction generated by the compiler and sectio...
void postAppend()
Called after a row is appended to the matrix.
uint8_t PrologueEnd
A boolean indicating that the current address is one (of possibly many) where execution should be sus...
uint16_t Column
An unsigned integer indicating a column number within a source line.
uint8_t EndSequence
A boolean indicating that the current address is that of the first byte after the end of a sequence o...
static void dumpTableHeader(raw_ostream &OS, unsigned Indent)
uint8_t IsStmt
A boolean indicating that the current instruction is the beginning of a statement.
void reset(bool DefaultIsStmt)
uint8_t Isa
An unsigned integer whose value encodes the applicable instruction set architecture for the current i...
void dump(raw_ostream &OS) const
uint8_t OpIndex
An unsigned integer representing the index of an operation within a VLIW instruction.
Represents a series of contiguous machine instructions.
uint64_t LowPC
Sequence describes instructions at address range [LowPC, HighPC) and is described by line table rows ...
static bool orderByHighPC(const Sequence &LHS, const Sequence &RHS)
bool containsPC(object::SectionedAddress PC) const
uint64_t SectionIndex
If relocation information is present then this is the index of the section which contains above addre...