Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:43

0001 //===-- BreakpointResolverFileRegex.h ----------------------------*- C++
0002 //-*-===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
0011 #define LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
0012 
0013 #include <set>
0014 #include "lldb/Breakpoint/BreakpointResolver.h"
0015 #include "lldb/Utility/ConstString.h"
0016 
0017 namespace lldb_private {
0018 
0019 /// \class BreakpointResolverFileRegex BreakpointResolverFileRegex.h
0020 /// "lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets
0021 /// breakpoints by file and line.  Optionally, it will look for inlined
0022 /// instances of the file and line specification.
0023 
0024 class BreakpointResolverFileRegex : public BreakpointResolver {
0025 public:
0026   BreakpointResolverFileRegex(
0027       const lldb::BreakpointSP &bkpt, RegularExpression regex,
0028       const std::unordered_set<std::string> &func_name_set, bool exact_match);
0029 
0030   static lldb::BreakpointResolverSP
0031   CreateFromStructuredData(const StructuredData::Dictionary &options_dict,
0032                            Status &error);
0033 
0034   StructuredData::ObjectSP SerializeToStructuredData() override;
0035 
0036   ~BreakpointResolverFileRegex() override = default;
0037 
0038   Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
0039                                           SymbolContext &context,
0040                                           Address *addr) override;
0041 
0042   lldb::SearchDepth GetDepth() override;
0043 
0044   void GetDescription(Stream *s) override;
0045 
0046   void Dump(Stream *s) const override;
0047 
0048   void AddFunctionName(const char *func_name);
0049 
0050   /// Methods for support type inquiry through isa, cast, and dyn_cast:
0051   static inline bool classof(const BreakpointResolverFileRegex *) {
0052     return true;
0053   }
0054   static inline bool classof(const BreakpointResolver *V) {
0055     return V->getResolverID() == BreakpointResolver::FileRegexResolver;
0056   }
0057 
0058   lldb::BreakpointResolverSP
0059   CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
0060 
0061 protected:
0062   friend class Breakpoint;
0063   RegularExpression
0064       m_regex;        // This is the line expression that we are looking for.
0065   bool m_exact_match; // If true, then if the source we match is in a comment,
0066                       // we won't set a location there.
0067   std::unordered_set<std::string> m_function_names; // Limit the search to
0068                                                     // functions in the
0069                                                     // comp_unit passed in.
0070 
0071 private:
0072   BreakpointResolverFileRegex(const BreakpointResolverFileRegex &) = delete;
0073   const BreakpointResolverFileRegex &
0074   operator=(const BreakpointResolverFileRegex &) = delete;
0075 };
0076 
0077 } // namespace lldb_private
0078 
0079 #endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H