10b57cec5SDimitry Andric //===-- BreakpointResolverAddress.h -----------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
95ffd83dbSDimitry Andric #ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERADDRESS_H
105ffd83dbSDimitry Andric #define LLDB_BREAKPOINT_BREAKPOINTRESOLVERADDRESS_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointResolver.h"
130b57cec5SDimitry Andric #include "lldb/Core/ModuleSpec.h"
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric namespace lldb_private {
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric /// \class BreakpointResolverAddress BreakpointResolverAddress.h
180b57cec5SDimitry Andric /// "lldb/Breakpoint/BreakpointResolverAddress.h" This class sets breakpoints
190b57cec5SDimitry Andric /// on a given Address.  This breakpoint only takes once, and then it won't
200b57cec5SDimitry Andric /// attempt to reset itself.
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric class BreakpointResolverAddress : public BreakpointResolver {
230b57cec5SDimitry Andric public:
245ffd83dbSDimitry Andric   BreakpointResolverAddress(const lldb::BreakpointSP &bkpt,
255ffd83dbSDimitry Andric                             const Address &addr);
260b57cec5SDimitry Andric 
275ffd83dbSDimitry Andric   BreakpointResolverAddress(const lldb::BreakpointSP &bkpt,
285ffd83dbSDimitry Andric                             const Address &addr,
290b57cec5SDimitry Andric                             const FileSpec &module_spec);
300b57cec5SDimitry Andric 
315ffd83dbSDimitry Andric   ~BreakpointResolverAddress() override = default;
320b57cec5SDimitry Andric 
335f757f3fSDimitry Andric   static lldb::BreakpointResolverSP
345f757f3fSDimitry Andric   CreateFromStructuredData(const StructuredData::Dictionary &options_dict,
350b57cec5SDimitry Andric                            Status &error);
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric   StructuredData::ObjectSP SerializeToStructuredData() override;
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric   void ResolveBreakpoint(SearchFilter &filter) override;
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric   void ResolveBreakpointInModules(SearchFilter &filter,
420b57cec5SDimitry Andric                                   ModuleList &modules) override;
430b57cec5SDimitry Andric 
440b57cec5SDimitry Andric   Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
459dba64beSDimitry Andric                                           SymbolContext &context,
469dba64beSDimitry Andric                                           Address *addr) override;
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric   lldb::SearchDepth GetDepth() override;
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric   void GetDescription(Stream *s) override;
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric   void Dump(Stream *s) const override;
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric   /// Methods for support type inquiry through isa, cast, and dyn_cast:
classof(const BreakpointResolverAddress *)550b57cec5SDimitry Andric   static inline bool classof(const BreakpointResolverAddress *) { return true; }
classof(const BreakpointResolver * V)560b57cec5SDimitry Andric   static inline bool classof(const BreakpointResolver *V) {
570b57cec5SDimitry Andric     return V->getResolverID() == BreakpointResolver::AddressResolver;
580b57cec5SDimitry Andric   }
590b57cec5SDimitry Andric 
605ffd83dbSDimitry Andric   lldb::BreakpointResolverSP
615ffd83dbSDimitry Andric   CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
620b57cec5SDimitry Andric 
630b57cec5SDimitry Andric protected:
645ffd83dbSDimitry Andric   Address m_addr;               // The address - may be Section Offset or
655ffd83dbSDimitry Andric                                 // may be just an offset
660b57cec5SDimitry Andric   lldb::addr_t m_resolved_addr; // The current value of the resolved load
670b57cec5SDimitry Andric                                 // address for this breakpoint,
680b57cec5SDimitry Andric   FileSpec m_module_filespec;   // If this filespec is Valid, and m_addr is an
690b57cec5SDimitry Andric                                 // offset, then it will be converted
700b57cec5SDimitry Andric   // to a Section+Offset address in this module, whenever that module gets
710b57cec5SDimitry Andric   // around to being loaded.
720b57cec5SDimitry Andric private:
735ffd83dbSDimitry Andric   BreakpointResolverAddress(const BreakpointResolverAddress &) = delete;
745ffd83dbSDimitry Andric   const BreakpointResolverAddress &
755ffd83dbSDimitry Andric   operator=(const BreakpointResolverAddress &) = delete;
760b57cec5SDimitry Andric };
770b57cec5SDimitry Andric 
780b57cec5SDimitry Andric } // namespace lldb_private
790b57cec5SDimitry Andric 
805ffd83dbSDimitry Andric #endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERADDRESS_H
81