LLVM  15.0.0git
DWARFDebugLine.h
Go to the documentation of this file.
1 //===- DWARFDebugLine.h -----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLINE_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLINE_H
11 
12 #include "llvm/ADT/Optional.h"
13 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/MD5.h"
19 #include "llvm/Support/Path.h"
20 #include <cstdint>
21 #include <map>
22 #include <string>
23 #include <vector>
24 
25 namespace llvm {
26 
27 class raw_ostream;
28 
30 public:
31  struct FileNameEntry {
32  FileNameEntry() = default;
33 
40  };
41 
42  /// Tracks which optional content types are present in a DWARF file name
43  /// entry format.
45  ContentTypeTracker() = default;
46 
47  /// Whether filename entries provide a modification timestamp.
48  bool HasModTime = false;
49  /// Whether filename entries provide a file size.
50  bool HasLength = false;
51  /// For v5, whether filename entries provide an MD5 checksum.
52  bool HasMD5 = false;
53  /// For v5, whether filename entries provide source text.
54  bool HasSource = false;
55 
56  /// Update tracked content types with \p ContentType.
58  };
59 
60  struct Prologue {
61  Prologue();
62 
63  /// The size in bytes of the statement information for this compilation unit
64  /// (not including the total_length field itself).
66  /// Version, address size (starting in v5), and DWARF32/64 format; these
67  /// parameters affect interpretation of forms (used in the directory and
68  /// file tables starting with v5).
70  /// The number of bytes following the prologue_length field to the beginning
71  /// of the first byte of the statement program itself.
73  /// In v5, size in bytes of a segment selector.
74  uint8_t SegSelectorSize;
75  /// The size in bytes of the smallest target machine instruction. Statement
76  /// program opcodes that alter the address register first multiply their
77  /// operands by this value.
78  uint8_t MinInstLength;
79  /// The maximum number of individual operations that may be encoded in an
80  /// instruction.
81  uint8_t MaxOpsPerInst;
82  /// The initial value of theis_stmtregister.
83  uint8_t DefaultIsStmt;
84  /// This parameter affects the meaning of the special opcodes. See below.
85  int8_t LineBase;
86  /// This parameter affects the meaning of the special opcodes. See below.
87  uint8_t LineRange;
88  /// The number assigned to the first special opcode.
89  uint8_t OpcodeBase;
90  /// This tracks which optional file format content types are present.
92  std::vector<uint8_t> StandardOpcodeLengths;
93  std::vector<DWARFFormValue> IncludeDirectories;
94  std::vector<FileNameEntry> FileNames;
95 
96  const dwarf::FormParams getFormParams() const { return FormParams; }
97  uint16_t getVersion() const { return FormParams.Version; }
98  uint8_t getAddressSize() const { return FormParams.AddrSize; }
99  bool isDWARF64() const { return FormParams.Format == dwarf::DWARF64; }
100 
101  uint32_t sizeofTotalLength() const { return isDWARF64() ? 12 : 4; }
102 
103  uint32_t sizeofPrologueLength() const { return isDWARF64() ? 8 : 4; }
104 
105  bool totalLengthIsValid() const;
106 
107  /// Length of the prologue in bytes.
108  uint64_t getLength() const;
109 
110  /// Get DWARF-version aware access to the file name entry at the provided
111  /// index.
113  getFileNameEntry(uint64_t Index) const;
114 
115  bool hasFileAtIndex(uint64_t FileIndex) const;
116 
118 
119  bool
120  getFileNameByIndex(uint64_t FileIndex, StringRef CompDir,
122  std::string &Result,
124 
125  void clear();
126  void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const;
128  function_ref<void(Error)> RecoverableErrorHandler,
129  const DWARFContext &Ctx, const DWARFUnit *U = nullptr);
130  };
131 
132  /// Standard .debug_line state machine structure.
133  struct Row {
134  explicit Row(bool DefaultIsStmt = false);
135 
136  /// Called after a row is appended to the matrix.
137  void postAppend();
138  void reset(bool DefaultIsStmt);
139  void dump(raw_ostream &OS) const;
140 
141  static void dumpTableHeader(raw_ostream &OS, unsigned Indent);
142 
143  static bool orderByAddress(const Row &LHS, const Row &RHS) {
144  return std::tie(LHS.Address.SectionIndex, LHS.Address.Address) <
145  std::tie(RHS.Address.SectionIndex, RHS.Address.Address);
146  }
147 
148  /// The program-counter value corresponding to a machine instruction
149  /// generated by the compiler and section index pointing to the section
150  /// containg this PC. If relocation information is present then section
151  /// index is the index of the section which contains above address.
152  /// Otherwise this is object::SectionedAddress::Undef value.
154  /// An unsigned integer indicating a source line number. Lines are numbered
155  /// beginning at 1. The compiler may emit the value 0 in cases where an
156  /// instruction cannot be attributed to any source line.
158  /// An unsigned integer indicating a column number within a source line.
159  /// Columns are numbered beginning at 1. The value 0 is reserved to indicate
160  /// that a statement begins at the 'left edge' of the line.
162  /// An unsigned integer indicating the identity of the source file
163  /// corresponding to a machine instruction.
165  /// An unsigned integer representing the DWARF path discriminator value
166  /// for this location.
168  /// An unsigned integer whose value encodes the applicable instruction set
169  /// architecture for the current instruction.
170  uint8_t Isa;
171  /// A boolean indicating that the current instruction is the beginning of a
172  /// statement.
173  uint8_t IsStmt : 1,
174  /// A boolean indicating that the current instruction is the
175  /// beginning of a basic block.
177  /// A boolean indicating that the current address is that of the
178  /// first byte after the end of a sequence of target machine
179  /// instructions.
181  /// A boolean indicating that the current address is one (of possibly
182  /// many) where execution should be suspended for an entry breakpoint
183  /// of a function.
185  /// A boolean indicating that the current address is one (of possibly
186  /// many) where execution should be suspended for an exit breakpoint
187  /// of a function.
189  };
190 
191  /// Represents a series of contiguous machine instructions. Line table for
192  /// each compilation unit may consist of multiple sequences, which are not
193  /// guaranteed to be in the order of ascending instruction address.
194  struct Sequence {
195  Sequence();
196 
197  /// Sequence describes instructions at address range [LowPC, HighPC)
198  /// and is described by line table rows [FirstRowIndex, LastRowIndex).
201  /// If relocation information is present then this is the index of the
202  /// section which contains above addresses. Otherwise this is
203  /// object::SectionedAddress::Undef value.
205  unsigned FirstRowIndex;
206  unsigned LastRowIndex;
207  bool Empty;
208 
209  void reset();
210 
211  static bool orderByHighPC(const Sequence &LHS, const Sequence &RHS) {
212  return std::tie(LHS.SectionIndex, LHS.HighPC) <
213  std::tie(RHS.SectionIndex, RHS.HighPC);
214  }
215 
216  bool isValid() const {
217  return !Empty && (LowPC < HighPC) && (FirstRowIndex < LastRowIndex);
218  }
219 
221  return SectionIndex == PC.SectionIndex &&
222  (LowPC <= PC.Address && PC.Address < HighPC);
223  }
224  };
225 
226  struct LineTable {
227  LineTable();
228 
229  /// Represents an invalid row
230  const uint32_t UnknownRowIndex = UINT32_MAX;
231 
232  void appendRow(const DWARFDebugLine::Row &R) { Rows.push_back(R); }
233 
235  Sequences.push_back(S);
236  }
237 
238  /// Returns the index of the row with file/line info for a given address,
239  /// or UnknownRowIndex if there is no such row.
241 
243  std::vector<uint32_t> &Result) const;
244 
245  bool hasFileAtIndex(uint64_t FileIndex) const {
246  return Prologue.hasFileAtIndex(FileIndex);
247  }
248 
251  }
252 
253  /// Extracts filename by its index in filename table in prologue.
254  /// In Dwarf 4, the files are 1-indexed and the current compilation file
255  /// name is not represented in the list. In DWARF v5, the files are
256  /// 0-indexed and the primary source file has the index 0.
257  /// Returns true on success.
258  bool getFileNameByIndex(uint64_t FileIndex, StringRef CompDir,
260  std::string &Result) const {
261  return Prologue.getFileNameByIndex(FileIndex, CompDir, Kind, Result);
262  }
263 
264  /// Fills the Result argument with the file and line information
265  /// corresponding to Address. Returns true on success.
267  const char *CompDir,
269  DILineInfo &Result) const;
270 
271  void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const;
272  void clear();
273 
274  /// Parse prologue and all rows.
275  Error parse(DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
276  const DWARFContext &Ctx, const DWARFUnit *U,
277  function_ref<void(Error)> RecoverableErrorHandler,
278  raw_ostream *OS = nullptr, bool Verbose = false);
279 
280  using RowVector = std::vector<Row>;
281  using RowIter = RowVector::const_iterator;
282  using SequenceVector = std::vector<Sequence>;
283  using SequenceIter = SequenceVector::const_iterator;
284 
288 
289  private:
290  uint32_t findRowInSeq(const DWARFDebugLine::Sequence &Seq,
291  object::SectionedAddress Address) const;
293  getSourceByIndex(uint64_t FileIndex,
295 
296  uint32_t lookupAddressImpl(object::SectionedAddress Address) const;
297 
298  bool lookupAddressRangeImpl(object::SectionedAddress Address, uint64_t Size,
299  std::vector<uint32_t> &Result) const;
300  };
301 
302  const LineTable *getLineTable(uint64_t Offset) const;
305  const DWARFContext &Ctx, const DWARFUnit *U,
306  function_ref<void(Error)> RecoverableErrorHandler);
307 
308  /// Helper to allow for parsing of an entire .debug_line section in sequence.
310  public:
311  using LineToUnitMap = std::map<uint64_t, DWARFUnit *>;
312 
315 
316  /// Get the next line table from the section. Report any issues via the
317  /// handlers.
318  ///
319  /// \param RecoverableErrorHandler - any issues that don't prevent further
320  /// parsing of the table will be reported through this handler.
321  /// \param UnrecoverableErrorHandler - any issues that prevent further
322  /// parsing of the table will be reported through this handler.
323  /// \param OS - if not null, the parser will print information about the
324  /// table as it parses it.
325  /// \param Verbose - if true, the parser will print verbose information when
326  /// printing to the output.
327  LineTable parseNext(function_ref<void(Error)> RecoverableErrorHandler,
328  function_ref<void(Error)> UnrecoverableErrorHandler,
329  raw_ostream *OS = nullptr, bool Verbose = false);
330 
331  /// Skip the current line table and go to the following line table (if
332  /// present) immediately.
333  ///
334  /// \param RecoverableErrorHandler - report any recoverable prologue
335  /// parsing issues via this handler.
336  /// \param UnrecoverableErrorHandler - report any unrecoverable prologue
337  /// parsing issues via this handler.
338  void skip(function_ref<void(Error)> RecoverableErrorHandler,
339  function_ref<void(Error)> UnrecoverableErrorHandler);
340 
341  /// Indicates if the parser has parsed as much as possible.
342  ///
343  /// \note Certain problems with the line table structure might mean that
344  /// parsing stops before the end of the section is reached.
345  bool done() const { return Done; }
346 
347  /// Get the offset the parser has reached.
348  uint64_t getOffset() const { return Offset; }
349 
350  private:
351  DWARFUnit *prepareToParse(uint64_t Offset);
352  void moveToNextTable(uint64_t OldOffset, const Prologue &P);
353 
354  LineToUnitMap LineToUnit;
355 
356  DWARFDataExtractor &DebugLineData;
357  const DWARFContext &Context;
358  uint64_t Offset = 0;
359  bool Done = false;
360  };
361 
362 private:
363  struct ParsingState {
364  ParsingState(struct LineTable *LT, uint64_t TableOffset,
366 
367  void resetRowAndSequence();
368  void appendRowToMatrix();
369 
370  /// Advance the address by the \p OperationAdvance value. \returns the
371  /// amount advanced by.
372  uint64_t advanceAddr(uint64_t OperationAdvance, uint8_t Opcode,
373  uint64_t OpcodeOffset);
374 
377  uint8_t AdjustedOpcode;
378  };
379 
380  /// Advance the address as required by the specified \p Opcode.
381  /// \returns the amount advanced by and the calculated adjusted opcode.
382  AddrAndAdjustedOpcode advanceAddrForOpcode(uint8_t Opcode,
383  uint64_t OpcodeOffset);
384 
387  int32_t Line;
388  };
389 
390  /// Advance the line and address as required by the specified special \p
391  /// Opcode. \returns the address and line delta.
392  AddrAndLineDelta handleSpecialOpcode(uint8_t Opcode, uint64_t OpcodeOffset);
393 
394  /// Line table we're currently parsing.
395  struct LineTable *LineTable;
396  struct Row Row;
397  struct Sequence Sequence;
398 
399  private:
400  uint64_t LineTableOffset;
401 
402  bool ReportAdvanceAddrProblem = true;
403  bool ReportBadLineRange = true;
405  };
406 
407  using LineTableMapTy = std::map<uint64_t, LineTable>;
408  using LineTableIter = LineTableMapTy::iterator;
409  using LineTableConstIter = LineTableMapTy::const_iterator;
410 
411  LineTableMapTy LineTableMap;
412 };
413 
414 } // end namespace llvm
415 
416 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGLINE_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:76
DWARFFormValue.h
llvm::dwarf::LineNumberEntryFormat
LineNumberEntryFormat
Definition: Dwarf.h:377
llvm::DWARFDebugLine::Prologue::sizeofTotalLength
uint32_t sizeofTotalLength() const
Definition: DWARFDebugLine.h:101
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DWARFDebugLine::SectionParser::getOffset
uint64_t getOffset() const
Get the offset the parser has reached.
Definition: DWARFDebugLine.h:348
llvm::DWARFDebugLine::Sequence::reset
void reset()
Definition: DWARFDebugLine.cpp:509
llvm::DWARFDebugLine::LineTable::SequenceVector
std::vector< Sequence > SequenceVector
Definition: DWARFDebugLine.h:282
Optional.h
llvm::DWARFDebugLine::getOrParseLineTable
Expected< const LineTable * > getOrParseLineTable(DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx, const DWARFUnit *U, function_ref< void(Error)> RecoverableErrorHandler)
Definition: DWARFDebugLine.cpp:584
llvm::DWARFDebugLine::Prologue::getAddressSize
uint8_t getAddressSize() const
Definition: DWARFDebugLine.h:98
llvm::DWARFDebugLine::Sequence::LastRowIndex
unsigned LastRowIndex
Definition: DWARFDebugLine.h:206
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::DWARFDebugLine::SectionParser::done
bool done() const
Indicates if the parser has parsed as much as possible.
Definition: DWARFDebugLine.h:345
llvm::DWARFDebugLine::LineTable::LineTable
LineTable()
Definition: DWARFDebugLine.cpp:518
Path.h
llvm::DWARFDebugLine::Row::EpilogueBegin
uint8_t EpilogueBegin
A boolean indicating that the current address is one (of possibly many) where execution should be sus...
Definition: DWARFDebugLine.h:188
llvm::DWARFDebugLine::Prologue::ContentTypes
ContentTypeTracker ContentTypes
This tracks which optional file format content types are present.
Definition: DWARFDebugLine.h:91
llvm::object::SectionedAddress::Address
uint64_t Address
Definition: ObjectFile.h:147
llvm::DWARFDebugLine::Row::IsStmt
uint8_t IsStmt
A boolean indicating that the current instruction is the beginning of a statement.
Definition: DWARFDebugLine.h:173
llvm::DWARFDebugLine::Row::dump
void dump(raw_ostream &OS) const
Definition: DWARFDebugLine.cpp:498
llvm::DWARFDebugLine::Prologue::IncludeDirectories
std::vector< DWARFFormValue > IncludeDirectories
Definition: DWARFDebugLine.h:93
llvm::DWARFDebugLine::Row::orderByAddress
static bool orderByAddress(const Row &LHS, const Row &RHS)
Definition: DWARFDebugLine.h:143
llvm::DWARFDebugLine::LineTable::appendSequence
void appendSequence(const DWARFDebugLine::Sequence &S)
Definition: DWARFDebugLine.h:234
llvm::DWARFContext
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition: DWARFContext.h:47
llvm::DWARFDebugLine::LineTable::UnknownRowIndex
const uint32_t UnknownRowIndex
Represents an invalid row.
Definition: DWARFDebugLine.h:230
llvm::DWARFDebugLine::Prologue::isDWARF64
bool isDWARF64() const
Definition: DWARFDebugLine.h:99
llvm::DWARFDebugLine::ParsingState::AddrAndLineDelta::Line
int32_t Line
Definition: DWARFDebugLine.h:387
llvm::dwarf::FormParams::AddrSize
uint8_t AddrSize
Definition: Dwarf.h:655
llvm::Optional< uint64_t >
llvm::DWARFDebugLine::Prologue::parse
Error parse(DWARFDataExtractor Data, uint64_t *OffsetPtr, function_ref< void(Error)> RecoverableErrorHandler, const DWARFContext &Ctx, const DWARFUnit *U=nullptr)
Definition: DWARFDebugLine.cpp:363
llvm::DWARFDebugLine::Prologue::TotalLength
uint64_t TotalLength
The size in bytes of the statement information for this compilation unit (not including the total_len...
Definition: DWARFDebugLine.h:65
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
llvm::DWARFDebugLine::ContentTypeTracker::HasModTime
bool HasModTime
Whether filename entries provide a modification timestamp.
Definition: DWARFDebugLine.h:48
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::DWARFDebugLine::FileNameEntry::FileNameEntry
FileNameEntry()=default
llvm::DWARFDebugLine::LineTable::RowIter
RowVector::const_iterator RowIter
Definition: DWARFDebugLine.h:281
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::DWARFDebugLine::ContentTypeTracker::HasLength
bool HasLength
Whether filename entries provide a file size.
Definition: DWARFDebugLine.h:50
llvm::DWARFDataExtractor
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
Definition: DWARFDataExtractor.h:21
llvm::DWARFDebugLine::LineTable::getFileLineInfoForAddress
bool getFileLineInfoForAddress(object::SectionedAddress Address, const char *CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, DILineInfo &Result) const
Fills the Result argument with the file and line information corresponding to Address.
Definition: DWARFDebugLine.cpp:1402
llvm::DWARFDebugLine::Prologue::sizeofPrologueLength
uint32_t sizeofPrologueLength() const
Definition: DWARFDebugLine.h:103
llvm::dwarf::FormParams::Format
DwarfFormat Format
Definition: Dwarf.h:656
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::DWARFDebugLine::Prologue::getFormParams
const dwarf::FormParams getFormParams() const
Definition: DWARFDebugLine.h:96
llvm::DWARFDebugLine::Prologue::LineRange
uint8_t LineRange
This parameter affects the meaning of the special opcodes. See below.
Definition: DWARFDebugLine.h:87
llvm::DWARFDebugLine::Row::BasicBlock
uint8_t BasicBlock
A boolean indicating that the current instruction is the beginning of a basic block.
Definition: DWARFDebugLine.h:176
llvm::DWARFDebugLine::getLineTable
const LineTable * getLineTable(uint64_t Offset) const
Definition: DWARFDebugLine.cpp:577
llvm::object::SectionedAddress::SectionIndex
uint64_t SectionIndex
Definition: ObjectFile.h:148
llvm::DWARFDebugLine::Sequence::Sequence
Sequence()
Definition: DWARFDebugLine.cpp:507
llvm::AArch64CC::LT
@ LT
Definition: AArch64BaseInfo.h:266
llvm::DWARFDebugLine::Row::Row
Row(bool DefaultIsStmt=false)
Definition: DWARFDebugLine.cpp:466
llvm::DWARFDebugLine::Row::EndSequence
uint8_t EndSequence
A boolean indicating that the current address is that of the first byte after the end of a sequence o...
Definition: DWARFDebugLine.h:180
llvm::DWARFDebugLine::Prologue::MinInstLength
uint8_t MinInstLength
The size in bytes of the smallest target machine instruction.
Definition: DWARFDebugLine.h:78
llvm::DWARFDebugLine::ParsingState::AddrAndLineDelta
Definition: DWARFDebugLine.h:385
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::DWARFDebugLine::Prologue::getFileNameEntry
const llvm::DWARFDebugLine::FileNameEntry & getFileNameEntry(uint64_t Index) const
Get DWARF-version aware access to the file name entry at the provided index.
Definition: DWARFDebugLine.cpp:99
ErrorHandler
static fatal_error_handler_t ErrorHandler
Definition: ErrorHandling.cpp:42
llvm::DWARFDebugLine::Prologue::MaxOpsPerInst
uint8_t MaxOpsPerInst
The maximum number of individual operations that may be encoded in an instruction.
Definition: DWARFDebugLine.h:81
llvm::DWARFDebugLine::Sequence::SectionIndex
uint64_t SectionIndex
If relocation information is present then this is the index of the section which contains above addre...
Definition: DWARFDebugLine.h:204
llvm::DWARFDebugLine::Row
Standard .debug_line state machine structure.
Definition: DWARFDebugLine.h:133
MD5.h
llvm::DWARFDebugLine::Prologue::hasFileAtIndex
bool hasFileAtIndex(uint64_t FileIndex) const
Definition: DWARFDebugLine.cpp:77
llvm::DWARFDebugLine::LineTable::parse
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.
Definition: DWARFDebugLine.cpp:728
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::DWARFDebugLine::Prologue::getLastValidFileIndex
Optional< uint64_t > getLastValidFileIndex() const
Definition: DWARFDebugLine.cpp:86
llvm::DWARFDebugLine::LineTable::appendRow
void appendRow(const DWARFDebugLine::Row &R)
Definition: DWARFDebugLine.h:232
llvm::DWARFDebugLine::Row::Isa
uint8_t Isa
An unsigned integer whose value encodes the applicable instruction set architecture for the current i...
Definition: DWARFDebugLine.h:170
llvm::DWARFDebugLine::Prologue::OpcodeBase
uint8_t OpcodeBase
The number assigned to the first special opcode.
Definition: DWARFDebugLine.h:89
llvm::DWARFDebugLine::Prologue::getFileNameByIndex
bool getFileNameByIndex(uint64_t FileIndex, StringRef CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, std::string &Result, sys::path::Style Style=sys::path::Style::native) const
Definition: DWARFDebugLine.cpp:1351
llvm::DWARFDebugLine::Prologue::FormParams
dwarf::FormParams FormParams
Version, address size (starting in v5), and DWARF32/64 format; these parameters affect interpretation...
Definition: DWARFDebugLine.h:69
llvm::DWARFDebugLine::LineTable::Rows
RowVector Rows
Definition: DWARFDebugLine.h:286
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::DWARFFormValue
Definition: DWARFFormValue.h:28
llvm::DWARFDebugLine::SectionParser::parseNext
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.
Definition: DWARFDebugLine.cpp:1447
llvm::DWARFDebugLine::Prologue::totalLengthIsValid
bool totalLengthIsValid() const
Definition: DWARFDebugLine.cpp:1443
llvm::sys::path::Style
Style
Definition: Path.h:27
llvm::DWARFDebugLine::FileNameEntry::Length
uint64_t Length
Definition: DWARFDebugLine.h:37
llvm::DWARFDebugLine::Prologue::SegSelectorSize
uint8_t SegSelectorSize
In v5, size in bytes of a segment selector.
Definition: DWARFDebugLine.h:74
llvm::DWARFDebugLine::Prologue::PrologueLength
uint64_t PrologueLength
The number of bytes following the prologue_length field to the beginning of the first byte of the sta...
Definition: DWARFDebugLine.h:72
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::DWARFDebugLine::LineTable::lookupAddressRange
bool lookupAddressRange(object::SectionedAddress Address, uint64_t Size, std::vector< uint32_t > &Result) const
Definition: DWARFDebugLine.cpp:1269
llvm::DWARFDebugLine
Definition: DWARFDebugLine.h:29
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::DWARFDebugLine::Sequence::HighPC
uint64_t HighPC
Definition: DWARFDebugLine.h:200
llvm::DWARFDebugLine::Sequence::orderByHighPC
static bool orderByHighPC(const Sequence &LHS, const Sequence &RHS)
Definition: DWARFDebugLine.h:211
llvm::DWARFDebugLine::Sequence
Represents a series of contiguous machine instructions.
Definition: DWARFDebugLine.h:194
llvm::DWARFDebugLine::Prologue
Definition: DWARFDebugLine.h:60
llvm::DWARFDebugLine::ParsingState::AddrAndAdjustedOpcode::AddrDelta
uint64_t AddrDelta
Definition: DWARFDebugLine.h:376
llvm::DWARFDebugLine::LineTable::getFileNameByIndex
bool getFileNameByIndex(uint64_t FileIndex, StringRef CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, std::string &Result) const
Extracts filename by its index in filename table in prologue.
Definition: DWARFDebugLine.h:258
uint64_t
llvm::DWARFDebugLine::SectionParser
Helper to allow for parsing of an entire .debug_line section in sequence.
Definition: DWARFDebugLine.h:309
llvm::DWARFDebugLine::ContentTypeTracker::ContentTypeTracker
ContentTypeTracker()=default
llvm::DWARFDebugLine::ParsingState::AddrAndAdjustedOpcode
Definition: DWARFDebugLine.h:375
llvm::DWARFDebugLine::Row::dumpTableHeader
static void dumpTableHeader(raw_ostream &OS, unsigned Indent)
Definition: DWARFDebugLine.cpp:490
llvm::DWARFDebugLine::Row::reset
void reset(bool DefaultIsStmt)
Definition: DWARFDebugLine.cpp:475
llvm::DWARFDebugLine::LineTable::Sequences
SequenceVector Sequences
Definition: DWARFDebugLine.h:287
DWARFUnit.h
llvm::DILineInfo
A format-neutral container for source line information.
Definition: DIContext.h:31
llvm::DILineInfoSpecifier::FileLineInfoKind
FileLineInfoKind
Definition: DIContext.h:138
llvm::DWARFDebugLine::FileNameEntry::DirIdx
uint64_t DirIdx
Definition: DWARFDebugLine.h:35
llvm::HexStyle::Style
Style
Definition: MCInstPrinter.h:32
llvm::dwarf::FormParams
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:653
llvm::DWARFDebugLine::ContentTypeTracker::HasMD5
bool HasMD5
For v5, whether filename entries provide an MD5 checksum.
Definition: DWARFDebugLine.h:52
llvm::sys::path::Style::native
@ native
llvm::DWARFDebugLine::LineTable::lookupAddress
uint32_t lookupAddress(object::SectionedAddress Address) const
Returns the index of the row with file/line info for a given address, or UnknownRowIndex if there is ...
Definition: DWARFDebugLine.cpp:1241
llvm::DWARFDebugLine::Sequence::FirstRowIndex
unsigned FirstRowIndex
Definition: DWARFDebugLine.h:205
llvm::DWARFDebugLine::Row::postAppend
void postAppend()
Called after a row is appended to the matrix.
Definition: DWARFDebugLine.cpp:468
llvm::DWARFDebugLine::ParsingState::AddrAndAdjustedOpcode::AdjustedOpcode
uint8_t AdjustedOpcode
Definition: DWARFDebugLine.h:377
llvm::DWARFDebugLine::Row::Discriminator
uint32_t Discriminator
An unsigned integer representing the DWARF path discriminator value for this location.
Definition: DWARFDebugLine.h:167
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
llvm::DWARFDebugLine::FileNameEntry
Definition: DWARFDebugLine.h:31
uint32_t
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::DWARFDebugLine::ContentTypeTracker
Tracks which optional content types are present in a DWARF file name entry format.
Definition: DWARFDebugLine.h:44
llvm::MD5::MD5Result
Definition: MD5.h:43
llvm::DWARFDebugLine::LineTable::SequenceIter
SequenceVector::const_iterator SequenceIter
Definition: DWARFDebugLine.h:283
DIContext.h
llvm::DWARFDebugLine::LineTable::hasFileAtIndex
bool hasFileAtIndex(uint64_t FileIndex) const
Definition: DWARFDebugLine.h:245
uint16_t
llvm::DWARFDebugLine::Sequence::isValid
bool isValid() const
Definition: DWARFDebugLine.h:216
llvm::DWARFUnit
Definition: DWARFUnit.h:205
llvm::DWARFDebugLine::Prologue::getLength
uint64_t getLength() const
Length of the prologue in bytes.
Definition: DWARFDebugLine.cpp:355
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::DWARFDebugLine::Row::Line
uint32_t Line
An unsigned integer indicating a source line number.
Definition: DWARFDebugLine.h:157
llvm::DWARFDebugLine::ContentTypeTracker::HasSource
bool HasSource
For v5, whether filename entries provide source text.
Definition: DWARFDebugLine.h:54
llvm::DWARFDebugLine::Prologue::DefaultIsStmt
uint8_t DefaultIsStmt
The initial value of theis_stmtregister.
Definition: DWARFDebugLine.h:83
llvm::DWARFDebugLine::Row::Address
object::SectionedAddress Address
The program-counter value corresponding to a machine instruction generated by the compiler and sectio...
Definition: DWARFDebugLine.h:153
llvm::DWARFDebugLine::FileNameEntry::Checksum
MD5::MD5Result Checksum
Definition: DWARFDebugLine.h:38
llvm::DWARFDebugLine::LineTable::getLastValidFileIndex
Optional< uint64_t > getLastValidFileIndex() const
Definition: DWARFDebugLine.h:249
llvm::DWARFDebugLine::Sequence::containsPC
bool containsPC(object::SectionedAddress PC) const
Definition: DWARFDebugLine.h:220
llvm::DWARFDebugLine::Prologue::LineBase
int8_t LineBase
This parameter affects the meaning of the special opcodes. See below.
Definition: DWARFDebugLine.h:85
llvm::DWARFDebugLine::Row::Column
uint16_t Column
An unsigned integer indicating a column number within a source line.
Definition: DWARFDebugLine.h:161
llvm::dwarf::FormParams::Version
uint16_t Version
Definition: Dwarf.h:654
llvm::DWARFDebugLine::Prologue::FileNames
std::vector< FileNameEntry > FileNames
Definition: DWARFDebugLine.h:94
llvm::DWARFDebugLine::ParsingState::AddrAndLineDelta::Address
uint64_t Address
Definition: DWARFDebugLine.h:386
llvm::DWARFDebugLine::Prologue::clear
void clear()
Definition: DWARFDebugLine.cpp:109
llvm::DWARFDebugLine::LineTable::RowVector
std::vector< Row > RowVector
Definition: DWARFDebugLine.h:280
llvm::DWARFDebugLine::FileNameEntry::Source
DWARFFormValue Source
Definition: DWARFDebugLine.h:39
llvm::DWARFDebugLine::Prologue::Prologue
Prologue()
Definition: DWARFDebugLine.cpp:75
llvm::DWARFDebugLine::Row::PrologueEnd
uint8_t PrologueEnd
A boolean indicating that the current address is one (of possibly many) where execution should be sus...
Definition: DWARFDebugLine.h:184
llvm::DWARFDebugLine::SectionParser::skip
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.
Definition: DWARFDebugLine.cpp:1463
llvm::DWARFDebugLine::Prologue::StandardOpcodeLengths
std::vector< uint8_t > StandardOpcodeLengths
Definition: DWARFDebugLine.h:92
llvm::DWARFDebugLine::Prologue::getVersion
uint16_t getVersion() const
Definition: DWARFDebugLine.h:97
llvm::object::SectionedAddress
Definition: ObjectFile.h:144
llvm::DWARFDebugLine::Sequence::LowPC
uint64_t LowPC
Sequence describes instructions at address range [LowPC, HighPC) and is described by line table rows ...
Definition: DWARFDebugLine.h:199
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::DWARFDebugLine::LineTable
Definition: DWARFDebugLine.h:226
llvm::DWARFDebugLine::SectionParser::SectionParser
SectionParser(DWARFDataExtractor &Data, const DWARFContext &C, DWARFUnitVector::iterator_range Units)
Definition: DWARFDebugLine.cpp:1434
llvm::DWARFDebugLine::Row::File
uint16_t File
An unsigned integer indicating the identity of the source file corresponding to a machine instruction...
Definition: DWARFDebugLine.h:164
llvm::DWARFDebugLine::SectionParser::LineToUnitMap
std::map< uint64_t, DWARFUnit * > LineToUnitMap
Definition: DWARFDebugLine.h:311
llvm::DWARFDebugLine::FileNameEntry::Name
DWARFFormValue Name
Definition: DWARFDebugLine.h:34
llvm::dwarf::DWARF64
@ DWARF64
Definition: Dwarf.h:93
llvm::DWARFDebugLine::FileNameEntry::ModTime
uint64_t ModTime
Definition: DWARFDebugLine.h:36
llvm::DWARFDebugLine::LineTable::dump
void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const
Definition: DWARFDebugLine.cpp:520
llvm::DWARFDebugLine::LineTable::clear
void clear()
Definition: DWARFDebugLine.cpp:537
llvm::DWARFDebugLine::Sequence::Empty
bool Empty
Definition: DWARFDebugLine.h:207
llvm::DWARFDebugLine::ContentTypeTracker::trackContentType
void trackContentType(dwarf::LineNumberEntryFormat ContentType)
Update tracked content types with ContentType.
Definition: DWARFDebugLine.cpp:53
llvm::DWARFDebugLine::Prologue::dump
void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const
Definition: DWARFDebugLine.cpp:121
llvm::DIDumpOptions
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:186