1254721Semaste//===-- LineEntry.h ---------------------------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef liblldb_LineEntry_h_
11254721Semaste#define liblldb_LineEntry_h_
12254721Semaste
13254721Semaste#include "lldb/lldb-private.h"
14254721Semaste#include "lldb/Core/AddressRange.h"
15254721Semaste#include "lldb/Host/FileSpec.h"
16254721Semaste
17254721Semastenamespace lldb_private {
18254721Semaste
19254721Semaste//----------------------------------------------------------------------
20254721Semaste/// @class LineEntry LineEntry.h "lldb/Symbol/LineEntry.h"
21254721Semaste/// @brief A line table entry class.
22254721Semaste//----------------------------------------------------------------------
23254721Semastestruct LineEntry
24254721Semaste{
25254721Semaste    //------------------------------------------------------------------
26254721Semaste    /// Default constructor.
27254721Semaste    ///
28254721Semaste    /// Initialize all member variables to invalid values.
29254721Semaste    //------------------------------------------------------------------
30254721Semaste    LineEntry ();
31254721Semaste
32254721Semaste    LineEntry
33254721Semaste    (
34254721Semaste        const lldb::SectionSP &section_sp,
35254721Semaste        lldb::addr_t section_offset,
36254721Semaste        lldb::addr_t byte_size,
37254721Semaste        const FileSpec &file,
38254721Semaste        uint32_t _line,
39254721Semaste        uint16_t _column,
40254721Semaste        bool _is_start_of_statement,
41254721Semaste        bool _is_start_of_basic_block,
42254721Semaste        bool _is_prologue_end,
43254721Semaste        bool _is_epilogue_begin,
44254721Semaste        bool _is_terminal_entry
45254721Semaste    );
46254721Semaste
47254721Semaste    //------------------------------------------------------------------
48254721Semaste    /// Clear the object's state.
49254721Semaste    ///
50254721Semaste    /// Clears all member variables to invalid values.
51254721Semaste    //------------------------------------------------------------------
52254721Semaste    void
53254721Semaste    Clear ();
54254721Semaste
55254721Semaste    //------------------------------------------------------------------
56254721Semaste    /// Dump a description of this object to a Stream.
57254721Semaste    ///
58254721Semaste    /// Dump a description of the contents of this object to the
59254721Semaste    /// supplied stream \a s.
60254721Semaste    ///
61254721Semaste    /// @param[in] s
62254721Semaste    ///     The stream to which to dump the object descripton.
63254721Semaste    ///
64254721Semaste    /// @param[in] comp_unit
65254721Semaste    ///     The compile unit object that contains the support file
66254721Semaste    ///     list so the line entry can dump the file name (since this
67254721Semaste    ///     object contains a file index into the support file list).
68254721Semaste    ///
69254721Semaste    /// @param[in] show_file
70254721Semaste    ///     If \b true, display the filename with the line entry which
71254721Semaste    ///     requires that the compile unit object \a comp_unit be a
72254721Semaste    ///     valid pointer.
73254721Semaste    ///
74254721Semaste    /// @param[in] style
75254721Semaste    ///     The display style for the section offset address.
76254721Semaste    ///
77254721Semaste    /// @return
78254721Semaste    ///     Returns \b true if the address was able to be displayed
79254721Semaste    ///     using \a style. File and load addresses may be unresolved
80254721Semaste    ///     and it may not be possible to display a valid address value.
81254721Semaste    ///     Returns \b false if the address was not able to be properly
82254721Semaste    ///     dumped.
83254721Semaste    ///
84254721Semaste    /// @see Address::DumpStyle
85254721Semaste    //------------------------------------------------------------------
86254721Semaste    bool
87254721Semaste    Dump (Stream *s, Target *target, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const;
88254721Semaste
89254721Semaste    bool
90254721Semaste    GetDescription (Stream *s,
91254721Semaste                    lldb::DescriptionLevel level,
92254721Semaste                    CompileUnit* cu,
93254721Semaste                    Target *target,
94254721Semaste                    bool show_address_only) const;
95254721Semaste
96254721Semaste    //------------------------------------------------------------------
97254721Semaste    /// Dumps information specific to a process that stops at this
98254721Semaste    /// line entry to the supplied stream \a s.
99254721Semaste    ///
100254721Semaste    /// @param[in] s
101254721Semaste    ///     The stream to which to dump the object descripton.
102254721Semaste    ///
103254721Semaste    /// @param[in] comp_unit
104254721Semaste    ///     The compile unit object that contains the support file
105254721Semaste    ///     list so the line entry can dump the file name (since this
106254721Semaste    ///     object contains a file index into the support file list).
107254721Semaste    ///
108254721Semaste    /// @return
109254721Semaste    ///     Returns \b true if the file and line were properly dumped,
110254721Semaste    ///     \b false otherwise.
111254721Semaste    //------------------------------------------------------------------
112254721Semaste    bool
113254721Semaste    DumpStopContext (Stream *s, bool show_fullpaths) const;
114254721Semaste
115254721Semaste    //------------------------------------------------------------------
116254721Semaste    /// Check if a line entry object is valid.
117254721Semaste    ///
118254721Semaste    /// @return
119254721Semaste    ///     Returns \b true if the line entry contains a valid section
120254721Semaste    ///     offset address, file index, and line number, \b false
121254721Semaste    ///     otherwise.
122254721Semaste    //------------------------------------------------------------------
123254721Semaste    bool
124254721Semaste    IsValid () const;
125254721Semaste
126254721Semaste    //------------------------------------------------------------------
127254721Semaste    /// Compare two LineEntry objects.
128254721Semaste    ///
129254721Semaste    /// @param[in] lhs
130254721Semaste    ///     The Left Hand Side const LineEntry object reference.
131254721Semaste    ///
132254721Semaste    /// @param[in] rhs
133254721Semaste    ///     The Right Hand Side const LineEntry object reference.
134254721Semaste    ///
135254721Semaste    /// @return
136254721Semaste    ///     @li -1 if lhs < rhs
137254721Semaste    ///     @li 0 if lhs == rhs
138254721Semaste    ///     @li 1 if lhs > rhs
139254721Semaste    //------------------------------------------------------------------
140254721Semaste    static int
141254721Semaste    Compare (const LineEntry& lhs, const LineEntry& rhs);
142254721Semaste
143254721Semaste
144254721Semaste    //------------------------------------------------------------------
145254721Semaste    // Member variables.
146254721Semaste    //------------------------------------------------------------------
147254721Semaste    AddressRange    range;                      ///< The section offset address range for this line entry.
148254721Semaste    FileSpec        file;
149254721Semaste    uint32_t        line;                       ///< The source line number, or zero if there is no line number information.
150254721Semaste    uint16_t        column;                     ///< The column number of the source line, or zero if there is no column information.
151254721Semaste    uint16_t        is_start_of_statement:1,    ///< Indicates this entry is the beginning of a statement.
152254721Semaste                    is_start_of_basic_block:1,  ///< Indicates this entry is the beginning of a basic block.
153254721Semaste                    is_prologue_end:1,          ///< Indicates this entry is one (of possibly many) where execution should be suspended for an entry breakpoint of a function.
154254721Semaste                    is_epilogue_begin:1,        ///< Indicates this entry is one (of possibly many) where execution should be suspended for an exit breakpoint of a function.
155254721Semaste                    is_terminal_entry:1;        ///< Indicates this entry is that of the first byte after the end of a sequence of target machine instructions.
156254721Semaste};
157254721Semaste
158254721Semaste//------------------------------------------------------------------
159254721Semaste/// Less than operator.
160254721Semaste///
161254721Semaste/// @param[in] lhs
162254721Semaste///     The Left Hand Side const LineEntry object reference.
163254721Semaste///
164254721Semaste/// @param[in] rhs
165254721Semaste///     The Right Hand Side const LineEntry object reference.
166254721Semaste///
167254721Semaste/// @return
168254721Semaste///     Returns \b true if lhs < rhs, false otherwise.
169254721Semaste//------------------------------------------------------------------
170254721Semastebool operator<(const LineEntry& lhs, const LineEntry& rhs);
171254721Semaste
172254721Semaste} // namespace lldb_private
173254721Semaste
174254721Semaste#endif  // liblldb_LineEntry_h_
175