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 #include "lldb/Core/SearchFilter.h"
14 #include "lldb/Symbol/SymbolContext.h"
15 #include "lldb/Utility/FileSpec.h"
16 #include "lldb/lldb-defines.h"
17 
18 #include <stdint.h>
19 
20 namespace lldb_private {
21 class Address;
22 }
23 namespace lldb_private {
24 class Stream;
25 }
26 
27 namespace lldb_private {
28 
29 //----------------------------------------------------------------------
30 /// @class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h"
31 /// This class finds address for source file and line.  Optionally, it will
32 /// look for inlined instances of the file and line specification.
33 //----------------------------------------------------------------------
34 
35 class FileLineResolver : public Searcher {
36 public:
FileLineResolver()37   FileLineResolver()
38       : m_file_spec(),
39         m_line_number(UINT32_MAX), // Set this to zero for all lines in a file
40         m_sc_list(), m_inlines(true) {}
41 
42   FileLineResolver(const FileSpec &resolver, uint32_t line_no,
43                    bool check_inlines);
44 
45   ~FileLineResolver() override;
46 
47   Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
48                                           SymbolContext &context, Address *addr,
49                                           bool containing) override;
50 
51   lldb::SearchDepth GetDepth() override;
52 
53   void GetDescription(Stream *s) override;
54 
GetFileLineMatches()55   const SymbolContextList &GetFileLineMatches() { return m_sc_list; }
56 
57   void Clear();
58 
59   void Reset(const FileSpec &file_spec, uint32_t line, bool check_inlines);
60 
61 protected:
62   FileSpec m_file_spec;   // This is the file spec we are looking for.
63   uint32_t m_line_number; // This is the line number that we are looking for.
64   SymbolContextList m_sc_list;
65   bool m_inlines; // This determines whether the resolver looks for inlined
66                   // functions or not.
67 
68 private:
69   DISALLOW_COPY_AND_ASSIGN(FileLineResolver);
70 };
71 
72 } // namespace lldb_private
73 
74 #endif // liblldb_FileLineResolver_h_
75