]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
Update libucl to latest git snapshot (20151027)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Breakpoint / BreakpointResolverName.h
1 //===-- BreakpointResolverName.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_BreakpointResolverName_h_
11 #define liblldb_BreakpointResolverName_h_
12
13 // C Includes
14 // C++ Includes
15 #include <vector>
16 #include <string>
17 // Other libraries and framework includes
18 // Project includes
19 #include "lldb/Breakpoint/BreakpointResolver.h"
20
21 namespace lldb_private {
22
23 //----------------------------------------------------------------------
24 /// @class BreakpointResolverName BreakpointResolverName.h "lldb/Breakpoint/BreakpointResolverName.h"
25 /// @brief This class sets breakpoints on a given function name, either by exact match
26 /// or by regular expression.
27 //----------------------------------------------------------------------
28
29 class BreakpointResolverName:
30     public BreakpointResolver
31 {
32 public:
33
34     BreakpointResolverName (Breakpoint *bkpt,
35                             const char *name,
36                             uint32_t name_type_mask,
37                             Breakpoint::MatchType type,
38                             bool skip_prologue);
39
40     // This one takes an array of names.  It is always MatchType = Exact.
41     BreakpointResolverName (Breakpoint *bkpt,
42                             const char *names[],
43                             size_t num_names,
44                             uint32_t name_type_mask,
45                             bool skip_prologue);
46
47     // This one takes a C++ array of names.  It is always MatchType = Exact.
48     BreakpointResolverName (Breakpoint *bkpt,
49                             std::vector<std::string> names,
50                             uint32_t name_type_mask,
51                             bool skip_prologue);
52
53     // Creates a function breakpoint by regular expression.  Takes over control of the lifespan of func_regex.
54     BreakpointResolverName (Breakpoint *bkpt,
55                             RegularExpression &func_regex,
56                             bool skip_prologue);
57
58     BreakpointResolverName (Breakpoint *bkpt,
59                             const char *class_name,
60                             const char *method,
61                             Breakpoint::MatchType type,
62                             bool skip_prologue);
63
64     virtual
65     ~BreakpointResolverName ();
66
67     Searcher::CallbackReturn
68     SearchCallback (SearchFilter &filter,
69                     SymbolContext &context,
70                     Address *addr,
71                     bool containing) override;
72
73     Searcher::Depth
74     GetDepth () override;
75
76     void
77     GetDescription (Stream *s) override;
78
79     void
80     Dump (Stream *s) const override;
81
82     /// Methods for support type inquiry through isa, cast, and dyn_cast:
83     static inline bool classof(const BreakpointResolverName *) { return true; }
84     static inline bool classof(const BreakpointResolver *V) {
85         return V->getResolverID() == BreakpointResolver::NameResolver;
86     }
87
88     lldb::BreakpointResolverSP
89     CopyForBreakpoint (Breakpoint &breakpoint) override;
90
91 protected:
92     BreakpointResolverName(const BreakpointResolverName &rhs);
93
94     struct LookupInfo
95     {
96         ConstString name;
97         ConstString lookup_name;
98         uint32_t name_type_mask; // See FunctionNameType
99         bool match_name_after_lookup;
100         
101         LookupInfo () :
102             name(),
103             lookup_name(),
104             name_type_mask (0),
105             match_name_after_lookup (false)
106         {
107         }
108         
109         void
110         Prune (SymbolContextList &sc_list,
111                size_t start_idx) const;
112     };
113     std::vector<LookupInfo> m_lookups;
114     ConstString m_class_name;
115     RegularExpression m_regex;
116     Breakpoint::MatchType m_match_type;
117     bool m_skip_prologue;
118
119     void
120     AddNameLookup (const ConstString &name, uint32_t name_type_mask);
121 };
122
123 } // namespace lldb_private
124
125 #endif  // liblldb_BreakpointResolverName_h_