]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/include/lldb/API/SBBreakpoint.h
Move all sources from the llvm project into contrib/llvm-project.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / include / lldb / API / SBBreakpoint.h
1 //===-- SBBreakpoint.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_SBBreakpoint_h_
10 #define LLDB_SBBreakpoint_h_
11
12 #include "lldb/API/SBDefines.h"
13
14 class SBBreakpointListImpl;
15
16 namespace lldb {
17
18 class LLDB_API SBBreakpoint {
19 public:
20
21   SBBreakpoint();
22
23   SBBreakpoint(const lldb::SBBreakpoint &rhs);
24
25   SBBreakpoint(const lldb::BreakpointSP &bp_sp);
26
27   ~SBBreakpoint();
28
29   const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
30
31   // Tests to see if the opaque breakpoint object in this object matches the
32   // opaque breakpoint object in "rhs".
33   bool operator==(const lldb::SBBreakpoint &rhs);
34
35   bool operator!=(const lldb::SBBreakpoint &rhs);
36
37   break_id_t GetID() const;
38
39   explicit operator bool() const;
40
41   bool IsValid() const;
42
43   void ClearAllBreakpointSites();
44
45   lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
46
47   lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
48
49   lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);
50
51   lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);
52
53   void SetEnabled(bool enable);
54
55   bool IsEnabled();
56
57   void SetOneShot(bool one_shot);
58
59   bool IsOneShot() const;
60
61   bool IsInternal();
62
63   uint32_t GetHitCount() const;
64
65   void SetIgnoreCount(uint32_t count);
66
67   uint32_t GetIgnoreCount() const;
68
69   void SetCondition(const char *condition);
70
71   const char *GetCondition();
72
73   void SetAutoContinue(bool auto_continue);
74
75   bool GetAutoContinue();
76
77   void SetThreadID(lldb::tid_t sb_thread_id);
78
79   lldb::tid_t GetThreadID();
80
81   void SetThreadIndex(uint32_t index);
82
83   uint32_t GetThreadIndex() const;
84
85   void SetThreadName(const char *thread_name);
86
87   const char *GetThreadName() const;
88
89   void SetQueueName(const char *queue_name);
90
91   const char *GetQueueName() const;
92
93   void SetCallback(SBBreakpointHitCallback callback, void *baton);
94
95   void SetScriptCallbackFunction(const char *callback_function_name);
96
97   void SetCommandLineCommands(SBStringList &commands);
98
99   bool GetCommandLineCommands(SBStringList &commands);
100
101   SBError SetScriptCallbackBody(const char *script_body_text);
102
103   bool AddName(const char *new_name);
104
105   void RemoveName(const char *name_to_remove);
106
107   bool MatchesName(const char *name);
108
109   void GetNames(SBStringList &names);
110
111   size_t GetNumResolvedLocations() const;
112
113   size_t GetNumLocations() const;
114
115   bool GetDescription(lldb::SBStream &description);
116
117   bool GetDescription(lldb::SBStream &description, bool include_locations);
118
119   static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
120
121   static lldb::BreakpointEventType
122   GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
123
124   static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
125
126   static lldb::SBBreakpointLocation
127   GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
128                                         uint32_t loc_idx);
129
130   static uint32_t
131   GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
132
133   bool IsHardware() const;
134
135   // Can only be called from a ScriptedBreakpointResolver...
136   SBError
137   AddLocation(SBAddress &address);
138   
139 private:
140   friend class SBBreakpointList;
141   friend class SBBreakpointLocation;
142   friend class SBBreakpointName;
143   friend class SBTarget;
144
145   lldb::BreakpointSP GetSP() const;
146
147   lldb::BreakpointWP m_opaque_wp;
148 };
149
150 class LLDB_API SBBreakpointList {
151 public:
152   SBBreakpointList(SBTarget &target);
153
154   ~SBBreakpointList();
155
156   size_t GetSize() const;
157
158   SBBreakpoint GetBreakpointAtIndex(size_t idx);
159
160   SBBreakpoint FindBreakpointByID(lldb::break_id_t);
161
162   void Append(const SBBreakpoint &sb_bkpt);
163
164   bool AppendIfUnique(const SBBreakpoint &sb_bkpt);
165
166   void AppendByID(lldb::break_id_t id);
167
168   void Clear();
169
170 protected:
171   friend class SBTarget;
172
173   void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);
174
175 private:
176   std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
177 };
178
179 } // namespace lldb
180
181 #endif // LLDB_SBBreakpoint_h_