1 //===-- SBBreakpoint.h ------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SBBreakpoint_h_
10 #define LLDB_SBBreakpoint_h_
12 #include "lldb/API/SBDefines.h"
14 class SBBreakpointListImpl;
18 class LLDB_API SBBreakpoint {
23 SBBreakpoint(const lldb::SBBreakpoint &rhs);
25 SBBreakpoint(const lldb::BreakpointSP &bp_sp);
29 const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
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);
35 bool operator!=(const lldb::SBBreakpoint &rhs);
37 break_id_t GetID() const;
39 explicit operator bool() const;
43 void ClearAllBreakpointSites();
45 lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
47 lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
49 lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);
51 lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);
53 void SetEnabled(bool enable);
57 void SetOneShot(bool one_shot);
59 bool IsOneShot() const;
63 uint32_t GetHitCount() const;
65 void SetIgnoreCount(uint32_t count);
67 uint32_t GetIgnoreCount() const;
69 void SetCondition(const char *condition);
71 const char *GetCondition();
73 void SetAutoContinue(bool auto_continue);
75 bool GetAutoContinue();
77 void SetThreadID(lldb::tid_t sb_thread_id);
79 lldb::tid_t GetThreadID();
81 void SetThreadIndex(uint32_t index);
83 uint32_t GetThreadIndex() const;
85 void SetThreadName(const char *thread_name);
87 const char *GetThreadName() const;
89 void SetQueueName(const char *queue_name);
91 const char *GetQueueName() const;
93 void SetCallback(SBBreakpointHitCallback callback, void *baton);
95 void SetScriptCallbackFunction(const char *callback_function_name);
97 SBError SetScriptCallbackFunction(const char *callback_function_name,
98 SBStructuredData &extra_args);
100 void SetCommandLineCommands(SBStringList &commands);
102 bool GetCommandLineCommands(SBStringList &commands);
104 SBError SetScriptCallbackBody(const char *script_body_text);
106 bool AddName(const char *new_name);
108 void RemoveName(const char *name_to_remove);
110 bool MatchesName(const char *name);
112 void GetNames(SBStringList &names);
114 size_t GetNumResolvedLocations() const;
116 size_t GetNumLocations() const;
118 bool GetDescription(lldb::SBStream &description);
120 bool GetDescription(lldb::SBStream &description, bool include_locations);
122 static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
124 static lldb::BreakpointEventType
125 GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
127 static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
129 static lldb::SBBreakpointLocation
130 GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
134 GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
136 bool IsHardware() const;
138 // Can only be called from a ScriptedBreakpointResolver...
140 AddLocation(SBAddress &address);
143 friend class SBBreakpointList;
144 friend class SBBreakpointLocation;
145 friend class SBBreakpointName;
146 friend class SBTarget;
148 lldb::BreakpointSP GetSP() const;
150 lldb::BreakpointWP m_opaque_wp;
153 class LLDB_API SBBreakpointList {
155 SBBreakpointList(SBTarget &target);
159 size_t GetSize() const;
161 SBBreakpoint GetBreakpointAtIndex(size_t idx);
163 SBBreakpoint FindBreakpointByID(lldb::break_id_t);
165 void Append(const SBBreakpoint &sb_bkpt);
167 bool AppendIfUnique(const SBBreakpoint &sb_bkpt);
169 void AppendByID(lldb::break_id_t id);
174 friend class SBTarget;
176 void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);
179 std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
184 #endif // LLDB_SBBreakpoint_h_