BreakpointResolverName.h revision 48fbdf7ffd3c5e28e7b954ed92345c1c45256109
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
37    // Creates a function breakpoint by regular expression.  Takes over control of the lifespan of func_regex.
38    BreakpointResolverName (Breakpoint *bkpt,
39                            RegularExpression &func_regex);
40
41    BreakpointResolverName (Breakpoint *bkpt,
42                            const char *class_name,
43                            const char *method,
44                            Breakpoint::MatchType type);
45
46    virtual
47    ~BreakpointResolverName ();
48
49    virtual Searcher::CallbackReturn
50    SearchCallback (SearchFilter &filter,
51                    SymbolContext &context,
52                    Address *addr,
53                    bool containing);
54
55    virtual Searcher::Depth
56    GetDepth ();
57
58    virtual void
59    GetDescription (Stream *s);
60
61    virtual void
62    Dump (Stream *s) const;
63
64protected:
65    ConstString m_func_name;
66    // "m_basename_filter" is used to filter results after searching for
67    // "m_func_name" first. This is used when we are asked to set a breakpoint
68    // at "foo::bar::baz" (C++ function in namespace or in a class). For
69    // "foo::bar::baz" we will place "baz" into m_func_name and search for all
70    // matching basename and methods that match "baz", then we will filter the
71    // results by checking if the demangled name contains "m_basename_filter"
72    // which would be set to "foo::bar::baz".
73    std::string m_basename_filter;
74    uint32_t m_func_name_type_mask;  // See FunctionNameType
75    ConstString m_class_name;  // FIXME: Not used yet.  The idea would be to stop on methods of this class.
76    RegularExpression m_regex;
77    Breakpoint::MatchType m_match_type;
78
79private:
80    DISALLOW_COPY_AND_ASSIGN(BreakpointResolverName);
81};
82
83} // namespace lldb_private
84
85#endif  // liblldb_BreakpointResolverName_h_
86