BreakpointResolverFileRegex.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
  10. #define LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
  11. #include <set>
  12. #include "lldb/Breakpoint/BreakpointResolver.h"
  13. #include "lldb/Utility/ConstString.h"
  14. namespace lldb_private {
  15. /// \class BreakpointResolverFileRegex BreakpointResolverFileRegex.h
  16. /// "lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets
  17. /// breakpoints by file and line. Optionally, it will look for inlined
  18. /// instances of the file and line specification.
  19. class BreakpointResolverFileRegex : public BreakpointResolver {
  20. public:
  21. BreakpointResolverFileRegex(
  22. const lldb::BreakpointSP &bkpt, RegularExpression regex,
  23. const std::unordered_set<std::string> &func_name_set, bool exact_match);
  24. static BreakpointResolver *
  25. CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
  26. const StructuredData::Dictionary &options_dict,
  27. Status &error);
  28. StructuredData::ObjectSP SerializeToStructuredData() override;
  29. ~BreakpointResolverFileRegex() override = default;
  30. Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
  31. SymbolContext &context,
  32. Address *addr) override;
  33. lldb::SearchDepth GetDepth() override;
  34. void GetDescription(Stream *s) override;
  35. void Dump(Stream *s) const override;
  36. void AddFunctionName(const char *func_name);
  37. /// Methods for support type inquiry through isa, cast, and dyn_cast:
  38. static inline bool classof(const BreakpointResolverFileRegex *) {
  39. return true;
  40. }
  41. static inline bool classof(const BreakpointResolver *V) {
  42. return V->getResolverID() == BreakpointResolver::FileRegexResolver;
  43. }
  44. lldb::BreakpointResolverSP
  45. CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
  46. protected:
  47. friend class Breakpoint;
  48. RegularExpression
  49. m_regex; // This is the line expression that we are looking for.
  50. bool m_exact_match; // If true, then if the source we match is in a comment,
  51. // we won't set a location there.
  52. std::unordered_set<std::string> m_function_names; // Limit the search to
  53. // functions in the
  54. // comp_unit passed in.
  55. private:
  56. BreakpointResolverFileRegex(const BreakpointResolverFileRegex &) = delete;
  57. const BreakpointResolverFileRegex &
  58. operator=(const BreakpointResolverFileRegex &) = delete;
  59. };
  60. } // namespace lldb_private
  61. #endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H