BreakpointResolverName.h revision c105362e1fd33664939811569dc4a540959e7db7
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// Other libraries and framework includes
16// Project includes
17#include "lldb/Breakpoint/BreakpointResolver.h"
18
19namespace lldb_private {
20
21//----------------------------------------------------------------------
22/// @class BreakpointResolverName BreakpointResolverName.h "lldb/Breakpoint/BreakpointResolverName.h"
23/// @brief This class sets breakpoints on a given function name, either by exact match
24/// or by regular expression.
25//----------------------------------------------------------------------
26
27class BreakpointResolverName:
28    public BreakpointResolver
29{
30public:
31
32    BreakpointResolverName (Breakpoint *bkpt,
33                            const char *name,
34                            uint32_t name_type_mask,
35                            Breakpoint::MatchType type,
36                            bool skip_prologue);
37
38    // This one takes an array of names.  It is always MatchType = Name.
39    BreakpointResolverName (Breakpoint *bkpt,
40                            const char *names[],
41                            size_t num_names,
42                            uint32_t name_type_mask,
43                            bool skip_prologue);
44
45    // Creates a function breakpoint by regular expression.  Takes over control of the lifespan of func_regex.
46    BreakpointResolverName (Breakpoint *bkpt,
47                            RegularExpression &func_regex,
48                            bool skip_prologue);
49
50    BreakpointResolverName (Breakpoint *bkpt,
51                            const char *class_name,
52                            const char *method,
53                            Breakpoint::MatchType type,
54                            bool skip_prologue);
55
56    virtual
57    ~BreakpointResolverName ();
58
59    virtual Searcher::CallbackReturn
60    SearchCallback (SearchFilter &filter,
61                    SymbolContext &context,
62                    Address *addr,
63                    bool containing);
64
65    virtual Searcher::Depth
66    GetDepth ();
67
68    virtual void
69    GetDescription (Stream *s);
70
71    virtual void
72    Dump (Stream *s) const;
73
74    /// Methods for support type inquiry through isa, cast, and dyn_cast:
75    static inline bool classof(const BreakpointResolverName *) { return true; }
76    static inline bool classof(const BreakpointResolver *V) {
77        return V->getResolverID() == BreakpointResolver::NameResolver;
78    }
79
80protected:
81    std::vector<ConstString> m_func_names;
82    uint32_t m_func_name_type_mask;  // See FunctionNameType
83    ConstString m_class_name;  // FIXME: Not used yet.  The idea would be to stop on methods of this class.
84    RegularExpression m_regex;
85    Breakpoint::MatchType m_match_type;
86    bool m_skip_prologue;
87
88private:
89    DISALLOW_COPY_AND_ASSIGN(BreakpointResolverName);
90};
91
92} // namespace lldb_private
93
94#endif  // liblldb_BreakpointResolverName_h_
95