1 //===-- LineEntry.h ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_LineEntry_h_
11 #define liblldb_LineEntry_h_
13 #include "lldb/lldb-private.h"
14 #include "lldb/Core/AddressRange.h"
15 #include "lldb/Host/FileSpec.h"
17 namespace lldb_private {
19 //----------------------------------------------------------------------
20 /// @class LineEntry LineEntry.h "lldb/Symbol/LineEntry.h"
21 /// @brief A line table entry class.
22 //----------------------------------------------------------------------
25 //------------------------------------------------------------------
26 /// Default constructor.
28 /// Initialize all member variables to invalid values.
29 //------------------------------------------------------------------
34 const lldb::SectionSP §ion_sp,
35 lldb::addr_t section_offset,
36 lldb::addr_t byte_size,
40 bool _is_start_of_statement,
41 bool _is_start_of_basic_block,
42 bool _is_prologue_end,
43 bool _is_epilogue_begin,
44 bool _is_terminal_entry
47 //------------------------------------------------------------------
48 /// Clear the object's state.
50 /// Clears all member variables to invalid values.
51 //------------------------------------------------------------------
55 //------------------------------------------------------------------
56 /// Dump a description of this object to a Stream.
58 /// Dump a description of the contents of this object to the
59 /// supplied stream \a s.
62 /// The stream to which to dump the object description.
64 /// @param[in] comp_unit
65 /// The compile unit object that contains the support file
66 /// list so the line entry can dump the file name (since this
67 /// object contains a file index into the support file list).
69 /// @param[in] show_file
70 /// If \b true, display the filename with the line entry which
71 /// requires that the compile unit object \a comp_unit be a
75 /// The display style for the section offset address.
78 /// Returns \b true if the address was able to be displayed
79 /// using \a style. File and load addresses may be unresolved
80 /// and it may not be possible to display a valid address value.
81 /// Returns \b false if the address was not able to be properly
84 /// @see Address::DumpStyle
85 //------------------------------------------------------------------
87 Dump (Stream *s, Target *target, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const;
90 GetDescription (Stream *s,
91 lldb::DescriptionLevel level,
94 bool show_address_only) const;
96 //------------------------------------------------------------------
97 /// Dumps information specific to a process that stops at this
98 /// line entry to the supplied stream \a s.
101 /// The stream to which to dump the object description.
103 /// @param[in] comp_unit
104 /// The compile unit object that contains the support file
105 /// list so the line entry can dump the file name (since this
106 /// object contains a file index into the support file list).
109 /// Returns \b true if the file and line were properly dumped,
110 /// \b false otherwise.
111 //------------------------------------------------------------------
113 DumpStopContext (Stream *s, bool show_fullpaths) const;
115 //------------------------------------------------------------------
116 /// Check if a line entry object is valid.
119 /// Returns \b true if the line entry contains a valid section
120 /// offset address, file index, and line number, \b false
122 //------------------------------------------------------------------
126 //------------------------------------------------------------------
127 /// Compare two LineEntry objects.
130 /// The Left Hand Side const LineEntry object reference.
133 /// The Right Hand Side const LineEntry object reference.
136 /// @li -1 if lhs < rhs
137 /// @li 0 if lhs == rhs
138 /// @li 1 if lhs > rhs
139 //------------------------------------------------------------------
141 Compare (const LineEntry& lhs, const LineEntry& rhs);
143 //------------------------------------------------------------------
144 /// Give the range for this LineEntry + any additional LineEntries for
145 /// this same source line that are contiguous.
147 /// A compiler may emit multiple line entries for a single source line,
148 /// e.g. to indicate subexpressions at different columns. This method
149 /// will get the AddressRange for all of the LineEntries for this source
150 /// line that are contiguous.
152 /// Line entries with a line number of 0 are treated specially - these
153 /// are compiler-generated line table entries that the user did not
154 /// write in their source code, and we want to skip past in the debugger.
155 /// If this LineEntry is for line 32, and the following LineEntry is for
156 /// line 0, we will extend the range to include the AddressRange of the
157 /// line 0 LineEntry (and it will include the range of the following
158 /// LineEntries that match either 32 or 0.)
160 /// If the initial LineEntry this method is called on is a line #0, only
161 /// the range of contiuous LineEntries with line #0 will be included in
162 /// the complete range.
165 /// The contiguous AddressRange for this source line.
166 //------------------------------------------------------------------
168 GetSameLineContiguousAddressRange () const;
170 //------------------------------------------------------------------
172 //------------------------------------------------------------------
173 AddressRange range; ///< The section offset address range for this line entry.
175 uint32_t line; ///< The source line number, or zero if there is no line number information.
176 uint16_t column; ///< The column number of the source line, or zero if there is no column information.
177 uint16_t is_start_of_statement:1, ///< Indicates this entry is the beginning of a statement.
178 is_start_of_basic_block:1, ///< Indicates this entry is the beginning of a basic block.
179 is_prologue_end:1, ///< Indicates this entry is one (of possibly many) where execution should be suspended for an entry breakpoint of a function.
180 is_epilogue_begin:1, ///< Indicates this entry is one (of possibly many) where execution should be suspended for an exit breakpoint of a function.
181 is_terminal_entry:1; ///< Indicates this entry is that of the first byte after the end of a sequence of target machine instructions.
184 //------------------------------------------------------------------
185 /// Less than operator.
188 /// The Left Hand Side const LineEntry object reference.
191 /// The Right Hand Side const LineEntry object reference.
194 /// Returns \b true if lhs < rhs, false otherwise.
195 //------------------------------------------------------------------
196 bool operator<(const LineEntry& lhs, const LineEntry& rhs);
198 } // namespace lldb_private
200 #endif // liblldb_LineEntry_h_