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 void SetCommandLineCommands(SBStringList &commands);
99 bool GetCommandLineCommands(SBStringList &commands);
101 SBError SetScriptCallbackBody(const char *script_body_text);
103 bool AddName(const char *new_name);
105 void RemoveName(const char *name_to_remove);
107 bool MatchesName(const char *name);
109 void GetNames(SBStringList &names);
111 size_t GetNumResolvedLocations() const;
113 size_t GetNumLocations() const;
115 bool GetDescription(lldb::SBStream &description);
117 bool GetDescription(lldb::SBStream &description, bool include_locations);
119 static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
121 static lldb::BreakpointEventType
122 GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
124 static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
126 static lldb::SBBreakpointLocation
127 GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
131 GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
133 bool IsHardware() const;
135 // Can only be called from a ScriptedBreakpointResolver...
137 AddLocation(SBAddress &address);
140 friend class SBBreakpointList;
141 friend class SBBreakpointLocation;
142 friend class SBBreakpointName;
143 friend class SBTarget;
145 lldb::BreakpointSP GetSP() const;
147 lldb::BreakpointWP m_opaque_wp;
150 class LLDB_API SBBreakpointList {
152 SBBreakpointList(SBTarget &target);
156 size_t GetSize() const;
158 SBBreakpoint GetBreakpointAtIndex(size_t idx);
160 SBBreakpoint FindBreakpointByID(lldb::break_id_t);
162 void Append(const SBBreakpoint &sb_bkpt);
164 bool AppendIfUnique(const SBBreakpoint &sb_bkpt);
166 void AppendByID(lldb::break_id_t id);
171 friend class SBTarget;
173 void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);
176 std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
181 #endif // LLDB_SBBreakpoint_h_