diff options
Diffstat (limited to 'include/llvm/DebugInfo/DWARF/DWARFDebugLine.h')
| -rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFDebugLine.h | 181 | 
1 files changed, 87 insertions, 94 deletions
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h index e5bb24707b63..dd0e2648bf30 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h +++ b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h @@ -24,7 +24,8 @@ class raw_ostream;  class DWARFDebugLine {  public: -  DWARFDebugLine(const RelocAddrMap* LineInfoRelocMap) : RelocMap(LineInfoRelocMap) {} +  DWARFDebugLine(const RelocAddrMap *LineInfoRelocMap) +      : RelocMap(LineInfoRelocMap) {}    struct FileNameEntry {      FileNameEntry() = default; @@ -38,50 +39,46 @@ public:    struct Prologue {      Prologue(); -    // The size in bytes of the statement information for this compilation unit -    // (not including the total_length field itself). +    /// The size in bytes of the statement information for this compilation unit +    /// (not including the total_length field itself).      uint64_t TotalLength; -    // Version identifier for the statement information format. +    /// Version identifier for the statement information format.      uint16_t Version; -    // The number of bytes following the prologue_length field to the beginning -    // of the first byte of the statement program itself. +    /// The number of bytes following the prologue_length field to the beginning +    /// of the first byte of the statement program itself.      uint64_t PrologueLength; -    // The size in bytes of the smallest target machine instruction. Statement -    // program opcodes that alter the address register first multiply their -    // operands by this value. +    /// The size in bytes of the smallest target machine instruction. Statement +    /// program opcodes that alter the address register first multiply their +    /// operands by this value.      uint8_t MinInstLength; -    // The maximum number of individual operations that may be encoded in an -    // instruction. +    /// The maximum number of individual operations that may be encoded in an +    /// instruction.      uint8_t MaxOpsPerInst; -    // The initial value of theis_stmtregister. +    /// The initial value of theis_stmtregister.      uint8_t DefaultIsStmt; -    // This parameter affects the meaning of the special opcodes. See below. +    /// This parameter affects the meaning of the special opcodes. See below.      int8_t LineBase; -    // This parameter affects the meaning of the special opcodes. See below. +    /// This parameter affects the meaning of the special opcodes. See below.      uint8_t LineRange; -    // The number assigned to the first special opcode. +    /// The number assigned to the first special opcode.      uint8_t OpcodeBase;      std::vector<uint8_t> StandardOpcodeLengths; -    std::vector<const char*> IncludeDirectories; +    std::vector<const char *> IncludeDirectories;      std::vector<FileNameEntry> FileNames;      bool IsDWARF64; -    uint32_t sizeofTotalLength() const { -      return IsDWARF64 ? 12 : 4; -    } +    uint32_t sizeofTotalLength() const { return IsDWARF64 ? 12 : 4; } -    uint32_t sizeofPrologueLength() const { -      return IsDWARF64 ? 8 : 4; -    } +    uint32_t sizeofPrologueLength() const { return IsDWARF64 ? 8 : 4; } -    // Length of the prologue in bytes. +    /// Length of the prologue in bytes.      uint32_t getLength() const {        return PrologueLength + sizeofTotalLength() + sizeof(Version) +               sizeofPrologueLength();      } -    // Length of the line table data in bytes (not including the prologue). +    /// Length of the line table data in bytes (not including the prologue).      uint32_t getStatementTableLength() const {        return TotalLength + sizeofTotalLength() - getLength();      } @@ -92,70 +89,70 @@ public:      void clear();      void dump(raw_ostream &OS) const; -    bool parse(DataExtractor debug_line_data, uint32_t *offset_ptr); +    bool parse(DataExtractor DebugLineData, uint32_t *OffsetPtr);    }; -  // Standard .debug_line state machine structure. +  /// Standard .debug_line state machine structure.    struct Row { -    explicit Row(bool default_is_stmt = false); +    explicit Row(bool DefaultIsStmt = false);      /// Called after a row is appended to the matrix.      void postAppend(); -    void reset(bool default_is_stmt); +    void reset(bool DefaultIsStmt);      void dump(raw_ostream &OS) const; -    static bool orderByAddress(const Row& LHS, const Row& RHS) { +    static bool orderByAddress(const Row &LHS, const Row &RHS) {        return LHS.Address < RHS.Address;      } -    // The program-counter value corresponding to a machine instruction -    // generated by the compiler. +    /// The program-counter value corresponding to a machine instruction +    /// generated by the compiler.      uint64_t Address; -    // An unsigned integer indicating a source line number. Lines are numbered -    // beginning at 1. The compiler may emit the value 0 in cases where an -    // instruction cannot be attributed to any source line. +    /// An unsigned integer indicating a source line number. Lines are numbered +    /// beginning at 1. The compiler may emit the value 0 in cases where an +    /// instruction cannot be attributed to any source line.      uint32_t Line; -    // An unsigned integer indicating a column number within a source line. -    // Columns are numbered beginning at 1. The value 0 is reserved to indicate -    // that a statement begins at the 'left edge' of the line. +    /// An unsigned integer indicating a column number within a source line. +    /// Columns are numbered beginning at 1. The value 0 is reserved to indicate +    /// that a statement begins at the 'left edge' of the line.      uint16_t Column; -    // An unsigned integer indicating the identity of the source file -    // corresponding to a machine instruction. +    /// An unsigned integer indicating the identity of the source file +    /// corresponding to a machine instruction.      uint16_t File; -    // An unsigned integer representing the DWARF path discriminator value -    // for this location. +    /// An unsigned integer representing the DWARF path discriminator value +    /// for this location.      uint32_t Discriminator; -    // An unsigned integer whose value encodes the applicable instruction set -    // architecture for the current instruction. +    /// An unsigned integer whose value encodes the applicable instruction set +    /// architecture for the current instruction.      uint8_t Isa; -    // A boolean indicating that the current instruction is the beginning of a -    // statement. -    uint8_t IsStmt:1, -            // A boolean indicating that the current instruction is the -            // beginning of a basic block. -            BasicBlock:1, -            // A boolean indicating that the current address is that of the -            // first byte after the end of a sequence of target machine -            // instructions. -            EndSequence:1, -            // A boolean indicating that the current address is one (of possibly -            // many) where execution should be suspended for an entry breakpoint -            // of a function. -            PrologueEnd:1, -            // A boolean indicating that the current address is one (of possibly -            // many) where execution should be suspended for an exit breakpoint -            // of a function. -            EpilogueBegin:1; +    /// A boolean indicating that the current instruction is the beginning of a +    /// statement. +    uint8_t IsStmt : 1, +        /// A boolean indicating that the current instruction is the +        /// beginning of a basic block. +        BasicBlock : 1, +        /// A boolean indicating that the current address is that of the +        /// first byte after the end of a sequence of target machine +        /// instructions. +        EndSequence : 1, +        /// A boolean indicating that the current address is one (of possibly +        /// many) where execution should be suspended for an entry breakpoint +        /// of a function. +        PrologueEnd : 1, +        /// A boolean indicating that the current address is one (of possibly +        /// many) where execution should be suspended for an exit breakpoint +        /// of a function. +        EpilogueBegin : 1;    }; -  // Represents a series of contiguous machine instructions. Line table for each -  // compilation unit may consist of multiple sequences, which are not -  // guaranteed to be in the order of ascending instruction address. +  /// Represents a series of contiguous machine instructions. Line table for +  /// each compilation unit may consist of multiple sequences, which are not +  /// guaranteed to be in the order of ascending instruction address.    struct Sequence {      Sequence(); -    // Sequence describes instructions at address range [LowPC, HighPC) -    // and is described by line table rows [FirstRowIndex, LastRowIndex). +    /// Sequence describes instructions at address range [LowPC, HighPC) +    /// and is described by line table rows [FirstRowIndex, LastRowIndex).      uint64_t LowPC;      uint64_t HighPC;      unsigned FirstRowIndex; @@ -164,7 +161,7 @@ public:      void reset(); -    static bool orderByLowPC(const Sequence& LHS, const Sequence& RHS) { +    static bool orderByLowPC(const Sequence &LHS, const Sequence &RHS) {        return LHS.LowPC < RHS.LowPC;      } @@ -172,42 +169,38 @@ public:        return !Empty && (LowPC < HighPC) && (FirstRowIndex < LastRowIndex);      } -    bool containsPC(uint64_t pc) const { -      return (LowPC <= pc && pc < HighPC); -    } +    bool containsPC(uint64_t PC) const { return (LowPC <= PC && PC < HighPC); }    };    struct LineTable {      LineTable(); -    // Represents an invalid row +    /// Represents an invalid row      const uint32_t UnknownRowIndex = UINT32_MAX; -    void appendRow(const DWARFDebugLine::Row &R) { -      Rows.push_back(R); -    } +    void appendRow(const DWARFDebugLine::Row &R) { Rows.push_back(R); }      void appendSequence(const DWARFDebugLine::Sequence &S) {        Sequences.push_back(S);      } -    // Returns the index of the row with file/line info for a given address, -    // or UnknownRowIndex if there is no such row. -    uint32_t lookupAddress(uint64_t address) const; +    /// Returns the index of the row with file/line info for a given address, +    /// or UnknownRowIndex if there is no such row. +    uint32_t lookupAddress(uint64_t Address) const; -    bool lookupAddressRange(uint64_t address, uint64_t size, -                            std::vector<uint32_t> &result) const; +    bool lookupAddressRange(uint64_t Address, uint64_t Size, +                            std::vector<uint32_t> &Result) const;      bool hasFileAtIndex(uint64_t FileIndex) const; -    // Extracts filename by its index in filename table in prologue. -    // Returns true on success. +    /// Extracts filename by its index in filename table in prologue. +    /// Returns true on success.      bool getFileNameByIndex(uint64_t FileIndex, const char *CompDir,                              DILineInfoSpecifier::FileLineInfoKind Kind,                              std::string &Result) const; -    // Fills the Result argument with the file and line information -    // corresponding to Address. Returns true on success. +    /// Fills the Result argument with the file and line information +    /// corresponding to Address. Returns true on success.      bool getFileLineInfoForAddress(uint64_t Address, const char *CompDir,                                     DILineInfoSpecifier::FileLineInfoKind Kind,                                     DILineInfo &Result) const; @@ -216,8 +209,8 @@ public:      void clear();      /// Parse prologue and all rows. -    bool parse(DataExtractor debug_line_data, const RelocAddrMap *RMap, -               uint32_t *offset_ptr); +    bool parse(DataExtractor DebugLineData, const RelocAddrMap *RMap, +               uint32_t *OffsetPtr);      struct Prologue Prologue;      typedef std::vector<Row> RowVector; @@ -228,25 +221,25 @@ public:      SequenceVector Sequences;    private: -    uint32_t findRowInSeq(const DWARFDebugLine::Sequence &seq, -                          uint64_t address) const; +    uint32_t findRowInSeq(const DWARFDebugLine::Sequence &Seq, +                          uint64_t Address) const;    }; -  const LineTable *getLineTable(uint32_t offset) const; -  const LineTable *getOrParseLineTable(DataExtractor debug_line_data, -                                       uint32_t offset); +  const LineTable *getLineTable(uint32_t Offset) const; +  const LineTable *getOrParseLineTable(DataExtractor DebugLineData, +                                       uint32_t Offset);  private:    struct ParsingState {      ParsingState(struct LineTable *LT);      void resetRowAndSequence(); -    void appendRowToMatrix(uint32_t offset); +    void appendRowToMatrix(uint32_t Offset); -    // Line table we're currently parsing. +    /// Line table we're currently parsing.      struct LineTable *LineTable; -    // The row number that starts at zero for the prologue, and increases for -    // each row added to the matrix. +    /// The row number that starts at zero for the prologue, and increases for +    /// each row added to the matrix.      unsigned RowNumber;      struct Row Row;      struct Sequence Sequence;  | 
