1 //===-- BreakpointResolverFileRegex.h ----------------------------*- C++
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_BreakpointResolverFileRegex_h_
11 #define liblldb_BreakpointResolverFileRegex_h_
14 #include "lldb/Breakpoint/BreakpointResolver.h"
15 #include "lldb/Utility/ConstString.h"
17 namespace lldb_private {
19 /// \class BreakpointResolverFileRegex BreakpointResolverFileRegex.h
20 /// "lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets
21 /// breakpoints by file and line. Optionally, it will look for inlined
22 /// instances of the file and line specification.
24 class BreakpointResolverFileRegex : public BreakpointResolver {
26 BreakpointResolverFileRegex(
27 Breakpoint *bkpt, RegularExpression regex,
28 const std::unordered_set<std::string> &func_name_set, bool exact_match);
30 static BreakpointResolver *
31 CreateFromStructuredData(Breakpoint *bkpt,
32 const StructuredData::Dictionary &options_dict,
35 StructuredData::ObjectSP SerializeToStructuredData() override;
37 ~BreakpointResolverFileRegex() override;
39 Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
40 SymbolContext &context,
41 Address *addr) override;
43 lldb::SearchDepth GetDepth() override;
45 void GetDescription(Stream *s) override;
47 void Dump(Stream *s) const override;
49 void AddFunctionName(const char *func_name);
51 /// Methods for support type inquiry through isa, cast, and dyn_cast:
52 static inline bool classof(const BreakpointResolverFileRegex *) {
55 static inline bool classof(const BreakpointResolver *V) {
56 return V->getResolverID() == BreakpointResolver::FileRegexResolver;
59 lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
62 friend class Breakpoint;
64 m_regex; // This is the line expression that we are looking for.
65 bool m_exact_match; // If true, then if the source we match is in a comment,
66 // we won't set a location there.
67 std::unordered_set<std::string> m_function_names; // Limit the search to
69 // comp_unit passed in.
72 DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
75 } // namespace lldb_private
77 #endif // liblldb_BreakpointResolverFileRegex_h_