]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
MFV r348578: 9962 zil_commit should omit cache thrash
[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 #include <string>
14 #include <vector>
15
16 #include "lldb/Breakpoint/BreakpointResolver.h"
17 #include "lldb/Core/Module.h"
18
19 namespace lldb_private {
20
21 //----------------------------------------------------------------------
22 /// @class BreakpointResolverName BreakpointResolverName.h
23 /// "lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on
24 /// a given function name, either by exact match or by regular expression.
25 //----------------------------------------------------------------------
26
27 class BreakpointResolverName : public BreakpointResolver {
28 public:
29   BreakpointResolverName(Breakpoint *bkpt, const char *name,
30                          lldb::FunctionNameType name_type_mask,
31                          lldb::LanguageType language,
32                          Breakpoint::MatchType type, lldb::addr_t offset,
33                          bool skip_prologue);
34
35   // This one takes an array of names.  It is always MatchType = Exact.
36   BreakpointResolverName(Breakpoint *bkpt, const char *names[],
37                          size_t num_names,
38                          lldb::FunctionNameType name_type_mask,
39                          lldb::LanguageType language, lldb::addr_t offset,
40                          bool skip_prologue);
41
42   // This one takes a C++ array of names.  It is always MatchType = Exact.
43   BreakpointResolverName(Breakpoint *bkpt, std::vector<std::string> names,
44                          lldb::FunctionNameType name_type_mask,
45                          lldb::LanguageType language, lldb::addr_t offset,
46                          bool skip_prologue);
47
48   // Creates a function breakpoint by regular expression.  Takes over control
49   // of the lifespan of func_regex.
50   BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex,
51                          lldb::LanguageType language, lldb::addr_t offset,
52                          bool skip_prologue);
53
54   static BreakpointResolver *
55   CreateFromStructuredData(Breakpoint *bkpt,
56                            const StructuredData::Dictionary &data_dict,
57                            Status &error);
58
59   StructuredData::ObjectSP SerializeToStructuredData() override;
60
61   ~BreakpointResolverName() override;
62
63   Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
64                                           SymbolContext &context, Address *addr,
65                                           bool containing) override;
66
67   lldb::SearchDepth GetDepth() override;
68
69   void GetDescription(Stream *s) override;
70
71   void Dump(Stream *s) const override;
72
73   /// Methods for support type inquiry through isa, cast, and dyn_cast:
74   static inline bool classof(const BreakpointResolverName *) { return true; }
75   static inline bool classof(const BreakpointResolver *V) {
76     return V->getResolverID() == BreakpointResolver::NameResolver;
77   }
78
79   lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
80
81 protected:
82   BreakpointResolverName(const BreakpointResolverName &rhs);
83
84   std::vector<Module::LookupInfo> m_lookups;
85   ConstString m_class_name;
86   RegularExpression m_regex;
87   Breakpoint::MatchType m_match_type;
88   lldb::LanguageType m_language;
89   bool m_skip_prologue;
90
91   void AddNameLookup(const ConstString &name,
92                      lldb::FunctionNameType name_type_mask);
93 };
94
95 } // namespace lldb_private
96
97 #endif // liblldb_BreakpointResolverName_h_