LLDB  mainline
BreakpointResolverFileRegex.h
Go to the documentation of this file.
1 //===-- BreakpointResolverFileRegex.h ----------------------------*- C++
2 //-*-===//
3 //
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
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
11 #define LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
12 
13 #include <set>
16 
17 namespace lldb_private {
18 
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.
23 
25 public:
27  const lldb::BreakpointSP &bkpt, RegularExpression regex,
28  const std::unordered_set<std::string> &func_name_set, bool exact_match);
29 
30  static BreakpointResolver *
31  CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
32  const StructuredData::Dictionary &options_dict,
33  Status &error);
34 
36 
37  ~BreakpointResolverFileRegex() override = default;
38 
40  SymbolContext &context,
41  Address *addr) override;
42 
43  lldb::SearchDepth GetDepth() override;
44 
45  void GetDescription(Stream *s) override;
46 
47  void Dump(Stream *s) const override;
48 
49  void AddFunctionName(const char *func_name);
50 
51  /// Methods for support type inquiry through isa, cast, and dyn_cast:
52  static inline bool classof(const BreakpointResolverFileRegex *) {
53  return true;
54  }
55  static inline bool classof(const BreakpointResolver *V) {
57  }
58 
59  lldb::BreakpointResolverSP
60  CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
61 
62 protected:
63  friend class Breakpoint;
65  m_regex; // This is the line expression that we are looking for.
66  bool m_exact_match; // If true, then if the source we match is in a comment,
67  // we won't set a location there.
68  std::unordered_set<std::string> m_function_names; // Limit the search to
69  // functions in the
70  // comp_unit passed in.
71 
72 private:
75  operator=(const BreakpointResolverFileRegex &) = delete;
76 };
77 
78 } // namespace lldb_private
79 
80 #endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
lldb_private::BreakpointResolverFileRegex
Definition: BreakpointResolverFileRegex.h:24
lldb_private::BreakpointResolverFileRegex::classof
static bool classof(const BreakpointResolver *V)
Definition: BreakpointResolverFileRegex.h:55
lldb_private::StructuredData::Dictionary
Definition: StructuredData.h:352
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb::SearchDepth
SearchDepth
Definition: lldb-enumerations.h:283
lldb_private::BreakpointResolverFileRegex::CopyForBreakpoint
lldb::BreakpointResolverSP CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override
Definition: BreakpointResolverFileRegex.cpp:161
lldb_private::BreakpointResolverFileRegex::classof
static bool classof(const BreakpointResolverFileRegex *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: BreakpointResolverFileRegex.h:52
lldb_private::BreakpointResolverFileRegex::GetDepth
lldb::SearchDepth GetDepth() override
Definition: BreakpointResolverFileRegex.cpp:149
BreakpointResolver.h
lldb_private::Stream
Definition: Stream.h:28
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::BreakpointResolverFileRegex::GetDescription
void GetDescription(Stream *s) override
Prints a canonical description for the breakpoint to the stream s.
Definition: BreakpointResolverFileRegex.cpp:153
lldb_private::BreakpointResolverFileRegex::SerializeToStructuredData
StructuredData::ObjectSP SerializeToStructuredData() override
Definition: BreakpointResolverFileRegex.cpp:75
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::SearchFilter
General Outline: Provides the callback and search depth for the SearchFilter search.
Definition: SearchFilter.h:83
lldb_private::BreakpointResolverFileRegex::Dump
void Dump(Stream *s) const override
Standard "Dump" method. At present it does nothing.
Definition: BreakpointResolverFileRegex.cpp:158
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::BreakpointResolverFileRegex::m_exact_match
bool m_exact_match
Definition: BreakpointResolverFileRegex.h:66
lldb_private::Searcher::CallbackReturn
CallbackReturn
Definition: SearchFilter.h:44
lldb_private::BreakpointResolver
General Outline: The BreakpointResolver is a Searcher.
Definition: BreakpointResolver.h:35
lldb_private::Status
Definition: Status.h:44
lldb_private::BreakpointResolver::FileRegexResolver
@ FileRegexResolver
Definition: BreakpointResolver.h:131
lldb_private::BreakpointResolverFileRegex::CreateFromStructuredData
static BreakpointResolver * CreateFromStructuredData(const lldb::BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error)
Definition: BreakpointResolverFileRegex.cpp:29
lldb_private::BreakpointResolverFileRegex::m_function_names
std::unordered_set< std::string > m_function_names
Definition: BreakpointResolverFileRegex.h:68
lldb_private::Address
Definition: Address.h:59
lldb_private::BreakpointResolverFileRegex::SearchCallback
Searcher::CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) override
Definition: BreakpointResolverFileRegex.cpp:95
lldb_private::BreakpointResolverFileRegex::operator=
const BreakpointResolverFileRegex & operator=(const BreakpointResolverFileRegex &)=delete
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::BreakpointResolverFileRegex::~BreakpointResolverFileRegex
~BreakpointResolverFileRegex() override=default
lldb_private::BreakpointResolverFileRegex::AddFunctionName
void AddFunctionName(const char *func_name)
Definition: BreakpointResolverFileRegex.cpp:167
ConstString.h
lldb_private::BreakpointResolverFileRegex::m_regex
RegularExpression m_regex
Definition: BreakpointResolverFileRegex.h:65
lldb_private::BreakpointResolverFileRegex::BreakpointResolverFileRegex
BreakpointResolverFileRegex(const lldb::BreakpointSP &bkpt, RegularExpression regex, const std::unordered_set< std::string > &func_name_set, bool exact_match)
Definition: BreakpointResolverFileRegex.cpp:22
lldb_private::Breakpoint
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:79
lldb_private::BreakpointResolver::getResolverID
unsigned getResolverID() const
getResolverID - Return an ID for the concrete type of this object.
Definition: BreakpointResolver.h:145