1 //===-- BreakpointResolverFileRegex.h ----------------------------*- C++
4 // The LLVM Compiler Infrastructure
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef liblldb_BreakpointResolverFileRegex_h_
12 #define liblldb_BreakpointResolverFileRegex_h_
17 // Other libraries and framework includes
19 #include "lldb/Breakpoint/BreakpointResolver.h"
20 #include "lldb/Utility/ConstString.h"
22 namespace lldb_private {
24 //----------------------------------------------------------------------
25 /// @class BreakpointResolverFileRegex BreakpointResolverFileRegex.h
26 /// "lldb/Breakpoint/BreakpointResolverFileRegex.h"
27 /// @brief This class sets breakpoints by file and line. Optionally, it will
29 /// instances of the file and line specification.
30 //----------------------------------------------------------------------
32 class BreakpointResolverFileRegex : public BreakpointResolver {
34 BreakpointResolverFileRegex(
35 Breakpoint *bkpt, RegularExpression ®ex,
36 const std::unordered_set<std::string> &func_name_set, bool exact_match);
38 static BreakpointResolver *
39 CreateFromStructuredData(Breakpoint *bkpt,
40 const StructuredData::Dictionary &options_dict,
43 StructuredData::ObjectSP SerializeToStructuredData() override;
45 ~BreakpointResolverFileRegex() override;
47 Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
48 SymbolContext &context, Address *addr,
49 bool containing) override;
51 Searcher::Depth GetDepth() override;
53 void GetDescription(Stream *s) override;
55 void Dump(Stream *s) const override;
57 void AddFunctionName(const char *func_name);
59 /// Methods for support type inquiry through isa, cast, and dyn_cast:
60 static inline bool classof(const BreakpointResolverFileRegex *) {
63 static inline bool classof(const BreakpointResolver *V) {
64 return V->getResolverID() == BreakpointResolver::FileRegexResolver;
67 lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
70 friend class Breakpoint;
72 m_regex; // This is the line expression that we are looking for.
73 bool m_exact_match; // If true, then if the source we match is in a comment,
74 // we won't set a location there.
75 std::unordered_set<std::string> m_function_names; // Limit the search to
77 // comp_unit passed in.
80 DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
83 } // namespace lldb_private
85 #endif // liblldb_BreakpointResolverFileRegex_h_