Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:51

0001 //===-- LineEntry.h ---------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_SYMBOL_LINEENTRY_H
0010 #define LLDB_SYMBOL_LINEENTRY_H
0011 
0012 #include "lldb/Core/AddressRange.h"
0013 #include "lldb/Utility/FileSpec.h"
0014 #include "lldb/Utility/SupportFile.h"
0015 #include "lldb/lldb-private.h"
0016 
0017 namespace lldb_private {
0018 
0019 /// \class LineEntry LineEntry.h "lldb/Symbol/LineEntry.h"
0020 /// A line table entry class.
0021 struct LineEntry {
0022   /// Default constructor.
0023   ///
0024   /// Initialize all member variables to invalid values.
0025   LineEntry();
0026 
0027   /// Clear the object's state.
0028   ///
0029   /// Clears all member variables to invalid values.
0030   void Clear();
0031 
0032   /// Dump a description of this object to a Stream.
0033   ///
0034   /// Dump a description of the contents of this object to the supplied stream
0035   /// \a s.
0036   ///
0037   /// \param[in] s
0038   ///     The stream to which to dump the object description.
0039   ///
0040   /// \param[in] show_file
0041   ///     If \b true, display the filename with the line entry which
0042   ///     requires that the compile unit object \a comp_unit be a
0043   ///     valid pointer.
0044   ///
0045   /// \param[in] style
0046   ///     The display style for the section offset address.
0047   ///
0048   /// \return
0049   ///     Returns \b true if the address was able to be displayed
0050   ///     using \a style. File and load addresses may be unresolved
0051   ///     and it may not be possible to display a valid address value.
0052   ///     Returns \b false if the address was not able to be properly
0053   ///     dumped.
0054   ///
0055   /// \see Address::DumpStyle
0056   bool Dump(Stream *s, Target *target, bool show_file, Address::DumpStyle style,
0057             Address::DumpStyle fallback_style, bool show_range) const;
0058 
0059   bool GetDescription(Stream *s, lldb::DescriptionLevel level, CompileUnit *cu,
0060                       Target *target, bool show_address_only) const;
0061 
0062   /// Dumps information specific to a process that stops at this line entry to
0063   /// the supplied stream \a s.
0064   ///
0065   /// \param[in] s
0066   ///     The stream to which to dump the object description.
0067   ///
0068   /// \return
0069   ///     Returns \b true if the file and line were properly dumped,
0070   ///     \b false otherwise.
0071   bool DumpStopContext(Stream *s, bool show_fullpaths) const;
0072 
0073   /// Check if a line entry object is valid.
0074   ///
0075   /// \return
0076   ///     Returns \b true if the line entry contains a valid section
0077   ///     offset address, file index, and line number, \b false
0078   ///     otherwise.
0079   bool IsValid() const;
0080 
0081   /// Compare two LineEntry objects.
0082   ///
0083   /// \param[in] lhs
0084   ///     The Left Hand Side const LineEntry object reference.
0085   ///
0086   /// \param[in] rhs
0087   ///     The Right Hand Side const LineEntry object reference.
0088   ///
0089   /// \return
0090   ///     -1 if lhs < rhs
0091   ///     0 if lhs == rhs
0092   ///     1 if lhs > rhs
0093   static int Compare(const LineEntry &lhs, const LineEntry &rhs);
0094 
0095   /// Give the range for this LineEntry + any additional LineEntries for this
0096   /// same source line that are contiguous.
0097   ///
0098   /// A compiler may emit multiple line entries for a single source line,
0099   /// e.g. to indicate subexpressions at different columns.  This method will
0100   /// get the AddressRange for all of the LineEntries for this source line
0101   /// that are contiguous.
0102   //
0103   /// Line entries with a line number of 0 are treated specially - these are
0104   /// compiler-generated line table entries that the user did not write in
0105   /// their source code, and we want to skip past in the debugger. If this
0106   /// LineEntry is for line 32, and the following LineEntry is for line 0, we
0107   /// will extend the range to include the AddressRange of the line 0
0108   /// LineEntry (and it will include the range of the following LineEntries
0109   /// that match either 32 or 0.)
0110   ///
0111   /// When \b include_inlined_functions is \b true inlined functions with
0112   /// a call site at this LineEntry will also be included in the complete
0113   /// range.
0114   ///
0115   /// If the initial LineEntry this method is called on is a line #0, only the
0116   /// range of continuous LineEntries with line #0 will be included in the
0117   /// complete range.
0118   ///
0119   /// @param[in] include_inlined_functions
0120   ///     Whether to include inlined functions at the same line or not.
0121   ///
0122   /// \return
0123   ///     The contiguous AddressRange for this source line.
0124   AddressRange
0125   GetSameLineContiguousAddressRange(bool include_inlined_functions) const;
0126 
0127   /// Apply file mappings from target.source-map to the LineEntry's file.
0128   ///
0129   /// \param[in] target_sp
0130   ///     Shared pointer to the target this LineEntry belongs to.
0131   void ApplyFileMappings(lldb::TargetSP target_sp);
0132 
0133   /// Helper to access the file.
0134   const FileSpec &GetFile() const { return file_sp->GetSpecOnly(); }
0135 
0136   /// The section offset address range for this line entry.
0137   AddressRange range;
0138 
0139   /// The source file, possibly mapped by the target.source-map setting.
0140   lldb::SupportFileSP file_sp;
0141 
0142   /// The original source file, from debug info.
0143   lldb::SupportFileSP original_file_sp;
0144 
0145   /// The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line
0146   /// number information.
0147   uint32_t line = LLDB_INVALID_LINE_NUMBER;
0148 
0149   /// The column number of the source line, or zero if there is no column
0150   /// information.
0151   uint16_t column = 0;
0152 
0153   /// Indicates this entry is the beginning of a statement.
0154   uint16_t is_start_of_statement : 1;
0155 
0156   /// Indicates this entry is the beginning of a basic block.
0157   uint16_t is_start_of_basic_block : 1;
0158 
0159   /// Indicates this entry is one (of possibly many) where execution should be
0160   /// suspended for an entry breakpoint of a function.
0161   uint16_t is_prologue_end : 1;
0162 
0163   /// Indicates this entry is one (of possibly many) where execution should be
0164   /// suspended for an exit breakpoint of a function.
0165   uint16_t is_epilogue_begin : 1;
0166 
0167   /// Indicates this entry is that of the first byte after the end of a sequence
0168   /// of target machine instructions.
0169   uint16_t is_terminal_entry : 1;
0170 };
0171 
0172 /// Less than operator.
0173 ///
0174 /// \param[in] lhs
0175 ///     The Left Hand Side const LineEntry object reference.
0176 ///
0177 /// \param[in] rhs
0178 ///     The Right Hand Side const LineEntry object reference.
0179 ///
0180 /// \return
0181 ///     Returns \b true if lhs < rhs, false otherwise.
0182 bool operator<(const LineEntry &lhs, const LineEntry &rhs);
0183 
0184 } // namespace lldb_private
0185 
0186 #endif // LLDB_SYMBOL_LINEENTRY_H