1 //===-- BreakpointResolver.h ------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_BreakpointResolver_h_
11 #define liblldb_BreakpointResolver_h_
15 // Other libraries and framework includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Core/Address.h"
19 #include "lldb/Breakpoint/Breakpoint.h"
20 #include "lldb/Breakpoint/BreakpointResolver.h"
21 #include "lldb/Host/FileSpec.h"
22 #include "lldb/Core/RegularExpression.h"
23 #include "lldb/Core/SearchFilter.h"
24 #include "lldb/Core/ConstString.h"
26 namespace lldb_private {
28 //----------------------------------------------------------------------
29 /// @class BreakpointResolver BreakpointResolver.h "lldb/Breakpoint/BreakpointResolver.h"
30 /// @brief This class works with SearchFilter to resolve logical breakpoints to their
31 /// of concrete breakpoint locations.
32 //----------------------------------------------------------------------
34 //----------------------------------------------------------------------
36 /// The BreakpointResolver 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 /// Each Breakpoint has a BreakpointResolver, and it calls either ResolveBreakpoint
41 /// or ResolveBreakpointInModules to tell it to look for new breakpoint locations.
42 //----------------------------------------------------------------------
44 class BreakpointResolver :
48 //------------------------------------------------------------------
49 /// The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint
50 /// to make sense. It can be constructed without a breakpoint, but you have to
51 /// call SetBreakpoint before ResolveBreakpoint.
54 /// The breakpoint that owns this resolver.
55 /// @param[in] resolverType
56 /// The concrete breakpoint resolver type for this breakpoint.
59 /// Returns breakpoint location id.
60 //------------------------------------------------------------------
61 BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType);
63 //------------------------------------------------------------------
64 /// The Destructor is virtual, all significant breakpoint resolvers derive
66 //------------------------------------------------------------------
68 ~BreakpointResolver ();
70 //------------------------------------------------------------------
71 /// This sets the breakpoint for this resolver.
74 /// The breakpoint that owns this resolver.
75 //------------------------------------------------------------------
77 SetBreakpoint (Breakpoint *bkpt);
79 //------------------------------------------------------------------
80 /// In response to this method the resolver scans all the modules in the breakpoint's
81 /// target, and adds any new locations it finds.
84 /// The filter that will manage the search for this resolver.
85 //------------------------------------------------------------------
87 ResolveBreakpoint (SearchFilter &filter);
89 //------------------------------------------------------------------
90 /// In response to this method the resolver scans the modules in the module list
91 /// \a modules, and adds any new locations it finds.
94 /// The filter that will manage the search for this resolver.
95 //------------------------------------------------------------------
97 ResolveBreakpointInModules (SearchFilter &filter,
100 //------------------------------------------------------------------
101 /// Prints a canonical description for the breakpoint to the stream \a s.
104 /// Stream to which the output is copied.
105 //------------------------------------------------------------------
107 GetDescription (Stream *s) = 0;
109 //------------------------------------------------------------------
110 /// Standard "Dump" method. At present it does nothing.
111 //------------------------------------------------------------------
113 Dump (Stream *s) const = 0;
115 //------------------------------------------------------------------
116 /// An enumeration for keeping track of the concrete subclass that
117 /// is actually instantiated. Values of this enumeration are kept in the
118 /// BreakpointResolver's SubclassID field. They are used for concrete type
121 FileLineResolver, // This is an instance of BreakpointResolverFileLine
122 AddressResolver, // This is an instance of BreakpointResolverAddress
123 NameResolver, // This is an instance of BreakpointResolverName
128 //------------------------------------------------------------------
129 /// getResolverID - Return an ID for the concrete type of this object. This
130 /// is used to implement the LLVM classof checks. This should not be used
131 /// for any other purpose, as the values may change as LLDB evolves.
132 unsigned getResolverID() const {
137 Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
140 // Subclass identifier (for llvm isa/dyn_cast)
141 const unsigned char SubclassID;
142 DISALLOW_COPY_AND_ASSIGN(BreakpointResolver);
145 } // namespace lldb_private
147 #endif // liblldb_BreakpointResolver_h_