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 liblldb_BreakpointResolverFileLine_h_
10 #define liblldb_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(Breakpoint *bkpt, const FileSpec &resolver,
24                              uint32_t line_no, uint32_t column,
25                              lldb::addr_t m_offset, bool check_inlines,
26                              bool skip_prologue, bool exact_match);
27 
28   static BreakpointResolver *
29   CreateFromStructuredData(Breakpoint *bkpt,
30                            const StructuredData::Dictionary &data_dict,
31                            Status &error);
32 
33   StructuredData::ObjectSP SerializeToStructuredData() override;
34 
35   ~BreakpointResolverFileLine() override;
36 
37   Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
38                                           SymbolContext &context,
39                                           Address *addr) override;
40 
41   lldb::SearchDepth GetDepth() override;
42 
43   void GetDescription(Stream *s) override;
44 
45   void Dump(Stream *s) const override;
46 
47   /// Methods for support type inquiry through isa, cast, and dyn_cast:
48   static inline bool classof(const BreakpointResolverFileLine *) {
49     return true;
50   }
51   static inline bool classof(const BreakpointResolver *V) {
52     return V->getResolverID() == BreakpointResolver::FileLineResolver;
53   }
54 
55   lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
56 
57 protected:
58   void FilterContexts(SymbolContextList &sc_list, bool is_relative);
59 
60   friend class Breakpoint;
61   FileSpec m_file_spec;   ///< This is the file spec we are looking for.
62   uint32_t m_line_number; ///< This is the line number that we are looking for.
63   uint32_t m_column;      ///< This is the column that we are looking for.
64   bool m_inlines; ///< This determines whether the resolver looks for inlined
65                   ///< functions or not.
66   bool m_skip_prologue;
67   bool m_exact_match;
68 
69 private:
70   DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
71 };
72 
73 } // namespace lldb_private
74 
75 #endif // liblldb_BreakpointResolverFileLine_h_
76