1 | //===-- AddressResolver.h ---------------------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLDB_CORE_ADDRESSRESOLVER_H |
10 | #define LLDB_CORE_ADDRESSRESOLVER_H |
11 | |
12 | #include "lldb/Core/AddressRange.h" |
13 | #include "lldb/Core/SearchFilter.h" |
14 | #include "lldb/lldb-defines.h" |
15 | |
16 | #include <cstddef> |
17 | #include <vector> |
18 | |
19 | namespace lldb_private { |
20 | class ModuleList; |
21 | class Stream; |
22 | |
23 | /// \class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h" |
24 | /// This class works with SearchFilter to resolve function names and source |
25 | /// file locations to their concrete addresses. |
26 | |
27 | /// General Outline: |
28 | /// The AddressResolver is a Searcher. In that protocol, the SearchFilter |
29 | /// asks the question "At what depth of the symbol context descent do you want |
30 | /// your callback to get called?" of the filter. The resolver answers this |
31 | /// question (in the GetDepth method) and provides the resolution callback. |
32 | |
33 | class AddressResolver : public Searcher { |
34 | public: |
35 | enum MatchType { Exact, Regexp, Glob }; |
36 | |
37 | AddressResolver(); |
38 | |
39 | ~AddressResolver() override; |
40 | |
41 | virtual void ResolveAddress(SearchFilter &filter); |
42 | |
43 | virtual void ResolveAddressInModules(SearchFilter &filter, |
44 | ModuleList &modules); |
45 | |
46 | void GetDescription(Stream *s) override = 0; |
47 | |
48 | std::vector<AddressRange> &GetAddressRanges(); |
49 | |
50 | size_t GetNumberOfAddresses(); |
51 | |
52 | AddressRange &GetAddressRangeAtIndex(size_t idx); |
53 | |
54 | protected: |
55 | std::vector<AddressRange> m_address_ranges; |
56 | |
57 | private: |
58 | AddressResolver(const AddressResolver &) = delete; |
59 | const AddressResolver &operator=(const AddressResolver &) = delete; |
60 | }; |
61 | |
62 | } // namespace lldb_private |
63 | |
64 | #endif // LLDB_CORE_ADDRESSRESOLVER_H |
65 | |