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 #include "lldb/Core/SourceLocationSpec.h"
14 
15 namespace lldb_private {
16 
17 /// \class BreakpointResolverFileLine BreakpointResolverFileLine.h
18 /// "lldb/Breakpoint/BreakpointResolverFileLine.h" This class sets breakpoints
19 /// by file and line.  Optionally, it will look for inlined instances of the
20 /// file and line specification.
21 
22 class BreakpointResolverFileLine : public BreakpointResolver {
23 public:
24   BreakpointResolverFileLine(const lldb::BreakpointSP &bkpt,
25                              lldb::addr_t offset, bool skip_prologue,
26                              const SourceLocationSpec &location_spec);
27 
28   static BreakpointResolver *
29   CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
30                            const StructuredData::Dictionary &data_dict,
31                            Status &error);
32 
33   StructuredData::ObjectSP SerializeToStructuredData() override;
34 
35   ~BreakpointResolverFileLine() override = default;
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
56   CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
57 
58 protected:
59   void FilterContexts(SymbolContextList &sc_list, bool is_relative);
60 
61   friend class Breakpoint;
62   SourceLocationSpec m_location_spec;
63   bool m_skip_prologue;
64 
65 private:
66   BreakpointResolverFileLine(const BreakpointResolverFileLine &) = delete;
67   const BreakpointResolverFileLine &
68   operator=(const BreakpointResolverFileLine &) = delete;
69 };
70 
71 } // namespace lldb_private
72 
73 #endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILELINE_H
74