1 //===-- BreakpointResolverFileLine.h ----------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILELINE_H
10 #define LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILELINE_H
11 
12 #include "lldb/Breakpoint/BreakpointResolver.h"
13 
14 namespace lldb_private {
15 
16 /// \class BreakpointResolverFileLine BreakpointResolverFileLine.h
17 /// "lldb/Breakpoint/BreakpointResolverFileLine.h" This class sets breakpoints
18 /// by file and line.  Optionally, it will look for inlined instances of the
19 /// file and line specification.
20 
21 class BreakpointResolverFileLine : public BreakpointResolver {
22 public:
23   BreakpointResolverFileLine(const lldb::BreakpointSP &bkpt,
24                              const FileSpec &resolver,
25                              uint32_t line_no, uint32_t column,
26                              lldb::addr_t m_offset, bool check_inlines,
27                              bool skip_prologue, bool exact_match);
28 
29   static BreakpointResolver *
30   CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
31                            const StructuredData::Dictionary &data_dict,
32                            Status &error);
33 
34   StructuredData::ObjectSP SerializeToStructuredData() override;
35 
36   ~BreakpointResolverFileLine() override = default;
37 
38   Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
39                                           SymbolContext &context,
40                                           Address *addr) override;
41 
42   lldb::SearchDepth GetDepth() override;
43 
44   void GetDescription(Stream *s) override;
45 
46   void Dump(Stream *s) const override;
47 
48   /// Methods for support type inquiry through isa, cast, and dyn_cast:
49   static inline bool classof(const BreakpointResolverFileLine *) {
50     return true;
51   }
52   static inline bool classof(const BreakpointResolver *V) {
53     return V->getResolverID() == BreakpointResolver::FileLineResolver;
54   }
55 
56   lldb::BreakpointResolverSP
57   CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
58 
59 protected:
60   void FilterContexts(SymbolContextList &sc_list, bool is_relative);
61 
62   friend class Breakpoint;
63   FileSpec m_file_spec;   ///< This is the file spec we are looking for.
64   uint32_t m_line_number; ///< This is the line number that we are looking for.
65   uint32_t m_column;      ///< This is the column that we are looking for.
66   bool m_inlines; ///< This determines whether the resolver looks for inlined
67                   ///< functions or not.
68   bool m_skip_prologue;
69   bool m_exact_match;
70 
71 private:
72   BreakpointResolverFileLine(const BreakpointResolverFileLine &) = delete;
73   const BreakpointResolverFileLine &
74   operator=(const BreakpointResolverFileLine &) = delete;
75 };
76 
77 } // namespace lldb_private
78 
79 #endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILELINE_H
80