Home | History | Annotate | Download | only in Core
      1 //===-- AddressResolver.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_AddressResolver_h_
     11 #define liblldb_AddressResolver_h_
     12 
     13 #include <vector>
     14 
     15 // C Includes
     16 // C++ Includes
     17 // Other libraries and framework includes
     18 // Project includes
     19 #include "lldb/lldb-private.h"
     20 #include "lldb/Core/Address.h"
     21 #include "lldb/Core/AddressRange.h"
     22 #include "lldb/Host/FileSpec.h"
     23 #include "lldb/Core/SearchFilter.h"
     24 #include "lldb/Core/ConstString.h"
     25 
     26 namespace lldb_private {
     27 
     28 //----------------------------------------------------------------------
     29 /// @class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h"
     30 /// @brief This class works with SearchFilter to resolve function names and
     31 /// source file locations to their concrete addresses.
     32 //----------------------------------------------------------------------
     33 
     34 //----------------------------------------------------------------------
     35 /// General Outline:
     36 /// The AddressResolver is a Searcher.  In that protocol,
     37 /// the SearchFilter asks the question "At what depth of the symbol context
     38 /// descent do you want your callback to get called?" of the filter.  The resolver
     39 /// answers this question (in the GetDepth method) and provides the resolution callback.
     40 //----------------------------------------------------------------------
     41 
     42 class AddressResolver :
     43    public Searcher
     44 {
     45 public:
     46 
     47     typedef enum
     48     {
     49         Exact,
     50         Regexp,
     51         Glob
     52     } MatchType;
     53 
     54 
     55     AddressResolver ();
     56 
     57     virtual
     58     ~AddressResolver ();
     59 
     60     virtual void
     61     ResolveAddress (SearchFilter &filter);
     62 
     63     virtual void
     64     ResolveAddressInModules (SearchFilter &filter,
     65                              ModuleList &modules);
     66 
     67     virtual void
     68     GetDescription (Stream *s) = 0;
     69 
     70     std::vector<AddressRange> &
     71     GetAddressRanges ();
     72 
     73     size_t
     74     GetNumberOfAddresses ();
     75 
     76     AddressRange &
     77     GetAddressRangeAtIndex (size_t idx);
     78 
     79 protected:
     80 
     81     std::vector<AddressRange> m_address_ranges;
     82 
     83 private:
     84     DISALLOW_COPY_AND_ASSIGN(AddressResolver);
     85 };
     86 
     87 } // namespace lldb_private
     88 
     89 #endif  // liblldb_AddressResolver_h_
     90