FileLineResolver.h revision 49ce8969d3154e1560106cfe530444c09410f217
1//===-- FileLineResolver.h --------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_FileLineResolver_h_
11#define liblldb_FileLineResolver_h_
12
13// Project includes
14#include "lldb/Core/AddressResolver.h"
15#include "lldb/Symbol/SymbolContext.h"
16
17namespace lldb_private {
18
19//----------------------------------------------------------------------
20/// @class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h"
21/// @brief This class finds address for source file and line.  Optionally, it will look for inlined
22/// instances of the file and line specification.
23//----------------------------------------------------------------------
24
25class FileLineResolver :
26    public Searcher
27{
28public:
29    FileLineResolver () :
30        m_file_spec(),
31        m_line_number(UINT32_MAX), // Set this to zero for all lines in a file
32        m_sc_list (),
33        m_inlines (true)
34    {
35    }
36
37    FileLineResolver (const FileSpec &resolver,
38                      uint32_t line_no,
39                      bool check_inlines);
40
41    virtual
42    ~FileLineResolver ();
43
44    virtual Searcher::CallbackReturn
45    SearchCallback (SearchFilter &filter,
46                    SymbolContext &context,
47                    Address *addr,
48                    bool containing);
49
50    virtual Searcher::Depth
51    GetDepth ();
52
53    virtual void
54    GetDescription (Stream *s);
55
56    const SymbolContextList &
57    GetFileLineMatches()
58    {
59        return m_sc_list;
60    }
61
62    void
63    Clear();
64
65    void
66    Reset (const FileSpec &file_spec,
67           uint32_t line,
68           bool check_inlines);
69protected:
70    FileSpec m_file_spec; // This is the file spec we are looking for.
71    uint32_t m_line_number; // This is the line number that we are looking for.
72    SymbolContextList m_sc_list;
73    bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
74
75private:
76    DISALLOW_COPY_AND_ASSIGN(FileLineResolver);
77};
78
79} // namespace lldb_private
80
81#endif  // liblldb_FileLineResolver_h_
82