1254721Semaste//===-- AddressResolver.h ---------------------------------------*- C++ -*-===//
2254721Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6254721Semaste//
7254721Semaste//===----------------------------------------------------------------------===//
8254721Semaste
9254721Semaste#ifndef liblldb_AddressResolver_h_
10254721Semaste#define liblldb_AddressResolver_h_
11254721Semaste
12254721Semaste#include "lldb/Core/AddressRange.h"
13314564Sdim#include "lldb/Core/SearchFilter.h"
14344779Sdim#include "lldb/lldb-defines.h"
15254721Semaste
16344779Sdim#include <stddef.h>
17321369Sdim#include <vector>
18321369Sdim
19254721Semastenamespace lldb_private {
20321369Sdimclass ModuleList;
21321369Sdimclass Stream;
22254721Semaste
23353358Sdim/// \class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h"
24341825Sdim/// This class works with SearchFilter to resolve function names and source
25341825Sdim/// file locations to their concrete addresses.
26254721Semaste
27254721Semaste/// General Outline:
28341825Sdim/// The AddressResolver is a Searcher.  In that protocol, the SearchFilter
29341825Sdim/// asks the question "At what depth of the symbol context descent do you want
30341825Sdim/// your callback to get called?" of the filter.  The resolver answers this
31341825Sdim/// question (in the GetDepth method) and provides the resolution callback.
32254721Semaste
33314564Sdimclass AddressResolver : public Searcher {
34254721Semastepublic:
35353358Sdim  enum MatchType { Exact, Regexp, Glob };
36254721Semaste
37314564Sdim  AddressResolver();
38254721Semaste
39314564Sdim  ~AddressResolver() override;
40254721Semaste
41314564Sdim  virtual void ResolveAddress(SearchFilter &filter);
42254721Semaste
43314564Sdim  virtual void ResolveAddressInModules(SearchFilter &filter,
44314564Sdim                                       ModuleList &modules);
45254721Semaste
46314564Sdim  void GetDescription(Stream *s) override = 0;
47254721Semaste
48314564Sdim  std::vector<AddressRange> &GetAddressRanges();
49254721Semaste
50314564Sdim  size_t GetNumberOfAddresses();
51254721Semaste
52314564Sdim  AddressRange &GetAddressRangeAtIndex(size_t idx);
53254721Semaste
54254721Semasteprotected:
55314564Sdim  std::vector<AddressRange> m_address_ranges;
56254721Semaste
57254721Semasteprivate:
58314564Sdim  DISALLOW_COPY_AND_ASSIGN(AddressResolver);
59254721Semaste};
60254721Semaste
61254721Semaste} // namespace lldb_private
62254721Semaste
63296417Sdim#endif // liblldb_AddressResolver_h_
64