Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 1 | //===- LineEntry.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_GSYM_LINEENTRY_H |
||
| 10 | #define LLVM_DEBUGINFO_GSYM_LINEENTRY_H |
||
| 11 | |||
| 12 | #include "llvm/DebugInfo/GSYM/ExtractRanges.h" |
||
| 13 | |||
| 14 | namespace llvm { |
||
| 15 | namespace gsym { |
||
| 16 | |||
| 17 | /// Line entries are used to encode the line tables in FunctionInfo objects. |
||
| 18 | /// They are stored as a sorted vector of these objects and store the |
||
| 19 | /// address, file and line of the line table row for a given address. The |
||
| 20 | /// size of a line table entry is calculated by looking at the next entry |
||
| 21 | /// in the FunctionInfo's vector of entries. |
||
| 22 | struct LineEntry { |
||
| 23 | uint64_t Addr; ///< Start address of this line entry. |
||
| 24 | uint32_t File; ///< 1 based index of file in FileTable |
||
| 25 | uint32_t Line; ///< Source line number. |
||
| 26 | LineEntry(uint64_t A = 0, uint32_t F = 0, uint32_t L = 0) |
||
| 27 | : Addr(A), File(F), Line(L) {} |
||
| 28 | bool isValid() { return File != 0; } |
||
| 29 | }; |
||
| 30 | |||
| 31 | inline raw_ostream &operator<<(raw_ostream &OS, const LineEntry &LE) { |
||
| 32 | return OS << "addr=" << HEX64(LE.Addr) << ", file=" << format("%3u", LE.File) |
||
| 33 | << ", line=" << format("%3u", LE.Line); |
||
| 34 | } |
||
| 35 | |||
| 36 | inline bool operator==(const LineEntry &LHS, const LineEntry &RHS) { |
||
| 37 | return LHS.Addr == RHS.Addr && LHS.File == RHS.File && LHS.Line == RHS.Line; |
||
| 38 | } |
||
| 39 | inline bool operator!=(const LineEntry &LHS, const LineEntry &RHS) { |
||
| 40 | return !(LHS == RHS); |
||
| 41 | } |
||
| 42 | inline bool operator<(const LineEntry &LHS, const LineEntry &RHS) { |
||
| 43 | return LHS.Addr < RHS.Addr; |
||
| 44 | } |
||
| 45 | } // namespace gsym |
||
| 46 | } // namespace llvm |
||
| 47 | #endif // LLVM_DEBUGINFO_GSYM_LINEENTRY_H |