1 //===-- SBWatchpoint.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_API_SBWATCHPOINT_H
10 #define LLDB_API_SBWATCHPOINT_H
11 
12 #include "lldb/API/SBDefines.h"
13 #include "lldb/API/SBType.h"
14 
15 namespace lldb_private {
16 namespace python {
17 class SWIGBridge;
18 }
19 namespace lua {
20 class SWIGBridge;
21 }
22 } // namespace lldb_private
23 
24 namespace lldb {
25 
26 class LLDB_API SBWatchpoint {
27 public:
28   SBWatchpoint();
29 
30   SBWatchpoint(const lldb::SBWatchpoint &rhs);
31 
32   ~SBWatchpoint();
33 
34   const lldb::SBWatchpoint &operator=(const lldb::SBWatchpoint &rhs);
35 
36   explicit operator bool() const;
37 
38   bool operator==(const SBWatchpoint &rhs) const;
39 
40   bool operator!=(const SBWatchpoint &rhs) const;
41 
42   bool IsValid() const;
43 
44   SBError GetError();
45 
46   watch_id_t GetID();
47 
48   LLDB_DEPRECATED("Hardware index is not available, always returns -1")
49   int32_t GetHardwareIndex();
50 
51   lldb::addr_t GetWatchAddress();
52 
53   size_t GetWatchSize();
54 
55   void SetEnabled(bool enabled);
56 
57   bool IsEnabled();
58 
59   uint32_t GetHitCount();
60 
61   uint32_t GetIgnoreCount();
62 
63   void SetIgnoreCount(uint32_t n);
64 
65   const char *GetCondition();
66 
67   void SetCondition(const char *condition);
68 
69   bool GetDescription(lldb::SBStream &description, DescriptionLevel level);
70 
71   void Clear();
72 
73   static bool EventIsWatchpointEvent(const lldb::SBEvent &event);
74 
75   static lldb::WatchpointEventType
76   GetWatchpointEventTypeFromEvent(const lldb::SBEvent &event);
77 
78   static lldb::SBWatchpoint GetWatchpointFromEvent(const lldb::SBEvent &event);
79 
80   lldb::SBType GetType();
81 
82   WatchpointValueKind GetWatchValueKind();
83 
84   const char *GetWatchSpec();
85 
86   bool IsWatchingReads();
87 
88   bool IsWatchingWrites();
89 
90 protected:
91   friend class lldb_private::python::SWIGBridge;
92   friend class lldb_private::lua::SWIGBridge;
93 
94   SBWatchpoint(const lldb::WatchpointSP &wp_sp);
95 
96   lldb::WatchpointSP GetSP() const;
97 
98   void SetSP(const lldb::WatchpointSP &sp);
99 
100 private:
101   friend class SBTarget;
102   friend class SBValue;
103 
104   std::weak_ptr<lldb_private::Watchpoint> m_opaque_wp;
105 };
106 
107 } // namespace lldb
108 
109 #endif // LLDB_API_SBWATCHPOINT_H
110