1254721Semaste//===-- BreakpointResolverAddress.h -----------------------------*- C++ -*-===//
2254721Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6254721Semaste//
7254721Semaste//===----------------------------------------------------------------------===//
8254721Semaste
9254721Semaste#ifndef liblldb_BreakpointResolverAddress_h_
10254721Semaste#define liblldb_BreakpointResolverAddress_h_
11254721Semaste
12254721Semaste#include "lldb/Breakpoint/BreakpointResolver.h"
13296417Sdim#include "lldb/Core/ModuleSpec.h"
14254721Semaste
15254721Semastenamespace lldb_private {
16254721Semaste
17353358Sdim/// \class BreakpointResolverAddress BreakpointResolverAddress.h
18341825Sdim/// "lldb/Breakpoint/BreakpointResolverAddress.h" This class sets breakpoints
19341825Sdim/// on a given Address.  This breakpoint only takes once, and then it won't
20341825Sdim/// attempt to reset itself.
21254721Semaste
22314564Sdimclass BreakpointResolverAddress : public BreakpointResolver {
23254721Semastepublic:
24314564Sdim  BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr);
25254721Semaste
26314564Sdim  BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr,
27314564Sdim                            const FileSpec &module_spec);
28254721Semaste
29314564Sdim  ~BreakpointResolverAddress() override;
30296417Sdim
31314564Sdim  static BreakpointResolver *
32314564Sdim  CreateFromStructuredData(Breakpoint *bkpt,
33314564Sdim                           const StructuredData::Dictionary &options_dict,
34321369Sdim                           Status &error);
35254721Semaste
36314564Sdim  StructuredData::ObjectSP SerializeToStructuredData() override;
37254721Semaste
38314564Sdim  void ResolveBreakpoint(SearchFilter &filter) override;
39254721Semaste
40314564Sdim  void ResolveBreakpointInModules(SearchFilter &filter,
41314564Sdim                                  ModuleList &modules) override;
42254721Semaste
43314564Sdim  Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
44360784Sdim                                          SymbolContext &context,
45360784Sdim                                          Address *addr) override;
46254721Semaste
47344779Sdim  lldb::SearchDepth GetDepth() override;
48254721Semaste
49314564Sdim  void GetDescription(Stream *s) override;
50254721Semaste
51314564Sdim  void Dump(Stream *s) const override;
52280031Sdim
53314564Sdim  /// Methods for support type inquiry through isa, cast, and dyn_cast:
54314564Sdim  static inline bool classof(const BreakpointResolverAddress *) { return true; }
55314564Sdim  static inline bool classof(const BreakpointResolver *V) {
56314564Sdim    return V->getResolverID() == BreakpointResolver::AddressResolver;
57314564Sdim  }
58314564Sdim
59314564Sdim  lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
60314564Sdim
61254721Semasteprotected:
62314564Sdim  Address
63314564Sdim      m_addr; // The address - may be Section Offset or may be just an offset
64314564Sdim  lldb::addr_t m_resolved_addr; // The current value of the resolved load
65314564Sdim                                // address for this breakpoint,
66314564Sdim  FileSpec m_module_filespec;   // If this filespec is Valid, and m_addr is an
67314564Sdim                                // offset, then it will be converted
68314564Sdim  // to a Section+Offset address in this module, whenever that module gets
69341825Sdim  // around to being loaded.
70254721Semasteprivate:
71314564Sdim  DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress);
72254721Semaste};
73254721Semaste
74254721Semaste} // namespace lldb_private
75254721Semaste
76296417Sdim#endif // liblldb_BreakpointResolverAddress_h_
77