180814287SRaphael Isemann //===-- SBBreakpoint.cpp --------------------------------------------------===//
230fdc8d8SChris Lattner //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
630fdc8d8SChris Lattner //
730fdc8d8SChris Lattner //===----------------------------------------------------------------------===//
830fdc8d8SChris Lattner 
930fdc8d8SChris Lattner #include "lldb/API/SBBreakpoint.h"
10baf5664fSJonas Devlieghere #include "SBReproducerPrivate.h"
1130fdc8d8SChris Lattner #include "lldb/API/SBBreakpointLocation.h"
1230fdc8d8SChris Lattner #include "lldb/API/SBDebugger.h"
139fed0d85SGreg Clayton #include "lldb/API/SBEvent.h"
1430fdc8d8SChris Lattner #include "lldb/API/SBProcess.h"
15dde9cff3SCaroline Tice #include "lldb/API/SBStream.h"
165e09c8c3SJim Ingham #include "lldb/API/SBStringList.h"
17738af7a6SJim Ingham #include "lldb/API/SBStructuredData.h"
1830fdc8d8SChris Lattner #include "lldb/API/SBThread.h"
1930fdc8d8SChris Lattner 
2030fdc8d8SChris Lattner #include "lldb/Breakpoint/Breakpoint.h"
2101f16664SJim Ingham #include "lldb/Breakpoint/BreakpointIDList.h"
2230fdc8d8SChris Lattner #include "lldb/Breakpoint/BreakpointLocation.h"
233815e702SJim Ingham #include "lldb/Breakpoint/BreakpointResolver.h"
243815e702SJim Ingham #include "lldb/Breakpoint/BreakpointResolverScripted.h"
2530fdc8d8SChris Lattner #include "lldb/Breakpoint/StoppointCallbackContext.h"
2630fdc8d8SChris Lattner #include "lldb/Core/Address.h"
27d80102e4SJim Ingham #include "lldb/Core/Debugger.h"
2830fdc8d8SChris Lattner #include "lldb/Core/StreamFile.h"
29738af7a6SJim Ingham #include "lldb/Core/StructuredDataImpl.h"
30d80102e4SJim Ingham #include "lldb/Interpreter/CommandInterpreter.h"
31d80102e4SJim Ingham #include "lldb/Interpreter/ScriptInterpreter.h"
3230fdc8d8SChris Lattner #include "lldb/Target/Process.h"
33d5944cd1SGreg Clayton #include "lldb/Target/SectionLoadList.h"
3430fdc8d8SChris Lattner #include "lldb/Target/Target.h"
3562b02c61SJim Ingham #include "lldb/Target/Thread.h"
3662b02c61SJim Ingham #include "lldb/Target/ThreadSpec.h"
37bf9a7730SZachary Turner #include "lldb/Utility/Stream.h"
3830fdc8d8SChris Lattner 
39b842f2ecSJim Ingham #include "SBBreakpointOptionCommon.h"
40b842f2ecSJim Ingham 
4130fdc8d8SChris Lattner #include "lldb/lldb-enumerations.h"
4230fdc8d8SChris Lattner 
434e4fbe82SZachary Turner #include "llvm/ADT/STLExtras.h"
444e4fbe82SZachary Turner 
4530fdc8d8SChris Lattner using namespace lldb;
4630fdc8d8SChris Lattner using namespace lldb_private;
4730fdc8d8SChris Lattner 
48baf5664fSJonas Devlieghere SBBreakpoint::SBBreakpoint() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBreakpoint); }
4930fdc8d8SChris Lattner 
50b9c1b51eSKate Stone SBBreakpoint::SBBreakpoint(const SBBreakpoint &rhs)
51baf5664fSJonas Devlieghere     : m_opaque_wp(rhs.m_opaque_wp) {
52baf5664fSJonas Devlieghere   LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &), rhs);
53baf5664fSJonas Devlieghere }
5430fdc8d8SChris Lattner 
55b9c1b51eSKate Stone SBBreakpoint::SBBreakpoint(const lldb::BreakpointSP &bp_sp)
56baf5664fSJonas Devlieghere     : m_opaque_wp(bp_sp) {
57baf5664fSJonas Devlieghere   LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &), bp_sp);
58baf5664fSJonas Devlieghere }
5930fdc8d8SChris Lattner 
60dbb0abbfSEugene Zelenko SBBreakpoint::~SBBreakpoint() = default;
6130fdc8d8SChris Lattner 
62b9c1b51eSKate Stone const SBBreakpoint &SBBreakpoint::operator=(const SBBreakpoint &rhs) {
63baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(const lldb::SBBreakpoint &,
64baf5664fSJonas Devlieghere                      SBBreakpoint, operator=,(const lldb::SBBreakpoint &), rhs);
65baf5664fSJonas Devlieghere 
666ac84034SPavel Labath   m_opaque_wp = rhs.m_opaque_wp;
67306809f2SJonas Devlieghere   return LLDB_RECORD_RESULT(*this);
6830fdc8d8SChris Lattner }
6930fdc8d8SChris Lattner 
70b9c1b51eSKate Stone bool SBBreakpoint::operator==(const lldb::SBBreakpoint &rhs) {
71baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(
72baf5664fSJonas Devlieghere       bool, SBBreakpoint, operator==,(const lldb::SBBreakpoint &), rhs);
73baf5664fSJonas Devlieghere 
746ac84034SPavel Labath   return m_opaque_wp.lock() == rhs.m_opaque_wp.lock();
75ac2eb9b1SGreg Clayton }
76ac2eb9b1SGreg Clayton 
77b9c1b51eSKate Stone bool SBBreakpoint::operator!=(const lldb::SBBreakpoint &rhs) {
78baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(
79baf5664fSJonas Devlieghere       bool, SBBreakpoint, operator!=,(const lldb::SBBreakpoint &), rhs);
80baf5664fSJonas Devlieghere 
816ac84034SPavel Labath   return m_opaque_wp.lock() != rhs.m_opaque_wp.lock();
82c3387333SEnrico Granata }
83c3387333SEnrico Granata 
84b9c1b51eSKate Stone break_id_t SBBreakpoint::GetID() const {
85baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::break_id_t, SBBreakpoint, GetID);
86baf5664fSJonas Devlieghere 
87af67cecdSGreg Clayton   break_id_t break_id = LLDB_INVALID_BREAK_ID;
886ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
896ac84034SPavel Labath   if (bkpt_sp)
906ac84034SPavel Labath     break_id = bkpt_sp->GetID();
91af67cecdSGreg Clayton 
92af67cecdSGreg Clayton   return break_id;
9330fdc8d8SChris Lattner }
9430fdc8d8SChris Lattner 
95b9c1b51eSKate Stone bool SBBreakpoint::IsValid() const {
96baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsValid);
977f5237bcSPavel Labath   return this->operator bool();
987f5237bcSPavel Labath }
997f5237bcSPavel Labath SBBreakpoint::operator bool() const {
1007f5237bcSPavel Labath   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, operator bool);
101baf5664fSJonas Devlieghere 
1026ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
1036ac84034SPavel Labath   if (!bkpt_sp)
104e029fa57SJim Ingham     return false;
1056ac84034SPavel Labath   else if (bkpt_sp->GetTarget().GetBreakpointByID(bkpt_sp->GetID()))
106e029fa57SJim Ingham     return true;
107e029fa57SJim Ingham   else
108e029fa57SJim Ingham     return false;
10930fdc8d8SChris Lattner }
11030fdc8d8SChris Lattner 
111b9c1b51eSKate Stone void SBBreakpoint::ClearAllBreakpointSites() {
112baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpoint, ClearAllBreakpointSites);
113baf5664fSJonas Devlieghere 
1146ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
1156ac84034SPavel Labath   if (bkpt_sp) {
116b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
1176ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
1186ac84034SPavel Labath     bkpt_sp->ClearAllBreakpointSites();
11930fdc8d8SChris Lattner   }
120af67cecdSGreg Clayton }
12130fdc8d8SChris Lattner 
122b9c1b51eSKate Stone SBBreakpointLocation SBBreakpoint::FindLocationByAddress(addr_t vm_addr) {
123baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
124baf5664fSJonas Devlieghere                      FindLocationByAddress, (lldb::addr_t), vm_addr);
125baf5664fSJonas Devlieghere 
12630fdc8d8SChris Lattner   SBBreakpointLocation sb_bp_location;
12730fdc8d8SChris Lattner 
1286ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
1296ac84034SPavel Labath   if (bkpt_sp) {
130b9c1b51eSKate Stone     if (vm_addr != LLDB_INVALID_ADDRESS) {
131b9c1b51eSKate Stone       std::lock_guard<std::recursive_mutex> guard(
1326ac84034SPavel Labath           bkpt_sp->GetTarget().GetAPIMutex());
13330fdc8d8SChris Lattner       Address address;
1346ac84034SPavel Labath       Target &target = bkpt_sp->GetTarget();
135b9c1b51eSKate Stone       if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
136e72dfb32SGreg Clayton         address.SetRawAddress(vm_addr);
13730fdc8d8SChris Lattner       }
1386ac84034SPavel Labath       sb_bp_location.SetLocation(bkpt_sp->FindLocationByAddress(address));
13930fdc8d8SChris Lattner     }
14030fdc8d8SChris Lattner   }
141baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(sb_bp_location);
14230fdc8d8SChris Lattner }
14330fdc8d8SChris Lattner 
144b9c1b51eSKate Stone break_id_t SBBreakpoint::FindLocationIDByAddress(addr_t vm_addr) {
145baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::break_id_t, SBBreakpoint, FindLocationIDByAddress,
146baf5664fSJonas Devlieghere                      (lldb::addr_t), vm_addr);
147baf5664fSJonas Devlieghere 
148af67cecdSGreg Clayton   break_id_t break_id = LLDB_INVALID_BREAK_ID;
1496ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
15030fdc8d8SChris Lattner 
1516ac84034SPavel Labath   if (bkpt_sp && vm_addr != LLDB_INVALID_ADDRESS) {
152b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
1536ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
15430fdc8d8SChris Lattner     Address address;
1556ac84034SPavel Labath     Target &target = bkpt_sp->GetTarget();
156b9c1b51eSKate Stone     if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
157e72dfb32SGreg Clayton       address.SetRawAddress(vm_addr);
15830fdc8d8SChris Lattner     }
1596ac84034SPavel Labath     break_id = bkpt_sp->FindLocationIDByAddress(address);
16030fdc8d8SChris Lattner   }
16130fdc8d8SChris Lattner 
162af67cecdSGreg Clayton   return break_id;
16330fdc8d8SChris Lattner }
16430fdc8d8SChris Lattner 
165b9c1b51eSKate Stone SBBreakpointLocation SBBreakpoint::FindLocationByID(break_id_t bp_loc_id) {
166baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, FindLocationByID,
167baf5664fSJonas Devlieghere                      (lldb::break_id_t), bp_loc_id);
168baf5664fSJonas Devlieghere 
16930fdc8d8SChris Lattner   SBBreakpointLocation sb_bp_location;
1706ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
17130fdc8d8SChris Lattner 
1726ac84034SPavel Labath   if (bkpt_sp) {
173b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
1746ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
1756ac84034SPavel Labath     sb_bp_location.SetLocation(bkpt_sp->FindLocationByID(bp_loc_id));
176af67cecdSGreg Clayton   }
17730fdc8d8SChris Lattner 
178baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(sb_bp_location);
17930fdc8d8SChris Lattner }
18030fdc8d8SChris Lattner 
181b9c1b51eSKate Stone SBBreakpointLocation SBBreakpoint::GetLocationAtIndex(uint32_t index) {
182baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
183baf5664fSJonas Devlieghere                      GetLocationAtIndex, (uint32_t), index);
184baf5664fSJonas Devlieghere 
18530fdc8d8SChris Lattner   SBBreakpointLocation sb_bp_location;
1866ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
18730fdc8d8SChris Lattner 
1886ac84034SPavel Labath   if (bkpt_sp) {
189b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
1906ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
1916ac84034SPavel Labath     sb_bp_location.SetLocation(bkpt_sp->GetLocationAtIndex(index));
192af67cecdSGreg Clayton   }
19330fdc8d8SChris Lattner 
194baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(sb_bp_location);
19530fdc8d8SChris Lattner }
19630fdc8d8SChris Lattner 
197b9c1b51eSKate Stone void SBBreakpoint::SetEnabled(bool enable) {
198baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetEnabled, (bool), enable);
199baf5664fSJonas Devlieghere 
2006ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
201ceb6b139SCaroline Tice 
2026ac84034SPavel Labath   if (bkpt_sp) {
203b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2046ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2056ac84034SPavel Labath     bkpt_sp->SetEnabled(enable);
20630fdc8d8SChris Lattner   }
207af67cecdSGreg Clayton }
20830fdc8d8SChris Lattner 
209b9c1b51eSKate Stone bool SBBreakpoint::IsEnabled() {
210baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsEnabled);
211baf5664fSJonas Devlieghere 
2126ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
2136ac84034SPavel Labath   if (bkpt_sp) {
214b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2156ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2166ac84034SPavel Labath     return bkpt_sp->IsEnabled();
217b9c1b51eSKate Stone   } else
21830fdc8d8SChris Lattner     return false;
21930fdc8d8SChris Lattner }
22030fdc8d8SChris Lattner 
221b9c1b51eSKate Stone void SBBreakpoint::SetOneShot(bool one_shot) {
222baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetOneShot, (bool), one_shot);
223baf5664fSJonas Devlieghere 
2246ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
225ca36cd16SJim Ingham 
2266ac84034SPavel Labath   if (bkpt_sp) {
227b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2286ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2296ac84034SPavel Labath     bkpt_sp->SetOneShot(one_shot);
230ca36cd16SJim Ingham   }
231ca36cd16SJim Ingham }
232ca36cd16SJim Ingham 
233b9c1b51eSKate Stone bool SBBreakpoint::IsOneShot() const {
234baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsOneShot);
235baf5664fSJonas Devlieghere 
2366ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
2376ac84034SPavel Labath   if (bkpt_sp) {
238b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2396ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2406ac84034SPavel Labath     return bkpt_sp->IsOneShot();
241b9c1b51eSKate Stone   } else
242ca36cd16SJim Ingham     return false;
243ca36cd16SJim Ingham }
244ca36cd16SJim Ingham 
245b9c1b51eSKate Stone bool SBBreakpoint::IsInternal() {
246baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsInternal);
247baf5664fSJonas Devlieghere 
2486ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
2496ac84034SPavel Labath   if (bkpt_sp) {
250b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2516ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2526ac84034SPavel Labath     return bkpt_sp->IsInternal();
253b9c1b51eSKate Stone   } else
25411c8108dSJim Ingham     return false;
25511c8108dSJim Ingham }
25611c8108dSJim Ingham 
257b9c1b51eSKate Stone void SBBreakpoint::SetIgnoreCount(uint32_t count) {
258baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t), count);
259baf5664fSJonas Devlieghere 
2606ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
261ceb6b139SCaroline Tice 
2626ac84034SPavel Labath   if (bkpt_sp) {
263b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2646ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2656ac84034SPavel Labath     bkpt_sp->SetIgnoreCount(count);
26630fdc8d8SChris Lattner   }
267af67cecdSGreg Clayton }
26830fdc8d8SChris Lattner 
269b9c1b51eSKate Stone void SBBreakpoint::SetCondition(const char *condition) {
270baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetCondition, (const char *),
271baf5664fSJonas Devlieghere                      condition);
272baf5664fSJonas Devlieghere 
2736ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
2746ac84034SPavel Labath   if (bkpt_sp) {
275b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2766ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2776ac84034SPavel Labath     bkpt_sp->SetCondition(condition);
278041a12fcSJim Ingham   }
279af67cecdSGreg Clayton }
280041a12fcSJim Ingham 
281b9c1b51eSKate Stone const char *SBBreakpoint::GetCondition() {
282baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBBreakpoint, GetCondition);
283baf5664fSJonas Devlieghere 
2846ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
2856ac84034SPavel Labath   if (bkpt_sp) {
286b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
2876ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
2886ac84034SPavel Labath     return bkpt_sp->GetConditionText();
289041a12fcSJim Ingham   }
290dbb0abbfSEugene Zelenko   return nullptr;
291af67cecdSGreg Clayton }
292041a12fcSJim Ingham 
293f08f5c99SJim Ingham void SBBreakpoint::SetAutoContinue(bool auto_continue) {
294baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetAutoContinue, (bool),
295baf5664fSJonas Devlieghere                      auto_continue);
296baf5664fSJonas Devlieghere 
297f08f5c99SJim Ingham   BreakpointSP bkpt_sp = GetSP();
298f08f5c99SJim Ingham   if (bkpt_sp) {
299f08f5c99SJim Ingham     std::lock_guard<std::recursive_mutex> guard(
300f08f5c99SJim Ingham         bkpt_sp->GetTarget().GetAPIMutex());
301f08f5c99SJim Ingham     bkpt_sp->SetAutoContinue(auto_continue);
302f08f5c99SJim Ingham   }
303f08f5c99SJim Ingham }
304f08f5c99SJim Ingham 
305f08f5c99SJim Ingham bool SBBreakpoint::GetAutoContinue() {
306baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, GetAutoContinue);
307baf5664fSJonas Devlieghere 
308f08f5c99SJim Ingham   BreakpointSP bkpt_sp = GetSP();
309f08f5c99SJim Ingham   if (bkpt_sp) {
310f08f5c99SJim Ingham     std::lock_guard<std::recursive_mutex> guard(
311f08f5c99SJim Ingham         bkpt_sp->GetTarget().GetAPIMutex());
312f08f5c99SJim Ingham     return bkpt_sp->IsAutoContinue();
313f08f5c99SJim Ingham   }
3141c7dc829SJim Ingham   return false;
315f08f5c99SJim Ingham }
316f08f5c99SJim Ingham 
317b9c1b51eSKate Stone uint32_t SBBreakpoint::GetHitCount() const {
318baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetHitCount);
319baf5664fSJonas Devlieghere 
3204838131bSGreg Clayton   uint32_t count = 0;
3216ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
3226ac84034SPavel Labath   if (bkpt_sp) {
323b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
3246ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
3256ac84034SPavel Labath     count = bkpt_sp->GetHitCount();
326af67cecdSGreg Clayton   }
3274838131bSGreg Clayton 
3284838131bSGreg Clayton   return count;
329ceb6b139SCaroline Tice }
3309fed0d85SGreg Clayton 
331b9c1b51eSKate Stone uint32_t SBBreakpoint::GetIgnoreCount() const {
332baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetIgnoreCount);
333baf5664fSJonas Devlieghere 
3344838131bSGreg Clayton   uint32_t count = 0;
3356ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
3366ac84034SPavel Labath   if (bkpt_sp) {
337b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
3386ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
3396ac84034SPavel Labath     count = bkpt_sp->GetIgnoreCount();
340af67cecdSGreg Clayton   }
3414838131bSGreg Clayton 
3424838131bSGreg Clayton   return count;
34330fdc8d8SChris Lattner }
34430fdc8d8SChris Lattner 
345b9c1b51eSKate Stone void SBBreakpoint::SetThreadID(tid_t tid) {
346baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t), tid);
347baf5664fSJonas Devlieghere 
3486ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
3496ac84034SPavel Labath   if (bkpt_sp) {
350b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
3516ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
3526ac84034SPavel Labath     bkpt_sp->SetThreadID(tid);
353af67cecdSGreg Clayton   }
35430fdc8d8SChris Lattner }
35530fdc8d8SChris Lattner 
356b9c1b51eSKate Stone tid_t SBBreakpoint::GetThreadID() {
357baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_NO_ARGS(lldb::tid_t, SBBreakpoint, GetThreadID);
358baf5664fSJonas Devlieghere 
3594838131bSGreg Clayton   tid_t tid = LLDB_INVALID_THREAD_ID;
3606ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
3616ac84034SPavel Labath   if (bkpt_sp) {
362b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
3636ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
3646ac84034SPavel Labath     tid = bkpt_sp->GetThreadID();
365af67cecdSGreg Clayton   }
36630fdc8d8SChris Lattner 
3674838131bSGreg Clayton   return tid;
36830fdc8d8SChris Lattner }
36930fdc8d8SChris Lattner 
370b9c1b51eSKate Stone void SBBreakpoint::SetThreadIndex(uint32_t index) {
371baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t), index);
372baf5664fSJonas Devlieghere 
3736ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
3746ac84034SPavel Labath   if (bkpt_sp) {
375b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
3766ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
3776ac84034SPavel Labath     bkpt_sp->GetOptions()->GetThreadSpec()->SetIndex(index);
37862b02c61SJim Ingham   }
379af67cecdSGreg Clayton }
38062b02c61SJim Ingham 
381b9c1b51eSKate Stone uint32_t SBBreakpoint::GetThreadIndex() const {
382baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetThreadIndex);
383baf5664fSJonas Devlieghere 
384bdf4c6acSGreg Clayton   uint32_t thread_idx = UINT32_MAX;
3856ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
3866ac84034SPavel Labath   if (bkpt_sp) {
387b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
3886ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
389b9c1b51eSKate Stone     const ThreadSpec *thread_spec =
3906ac84034SPavel Labath         bkpt_sp->GetOptions()->GetThreadSpecNoCreate();
391dbb0abbfSEugene Zelenko     if (thread_spec != nullptr)
3924838131bSGreg Clayton       thread_idx = thread_spec->GetIndex();
39362b02c61SJim Ingham   }
3944838131bSGreg Clayton 
395763d1a17SJohnny Chen   return thread_idx;
39662b02c61SJim Ingham }
39762b02c61SJim Ingham 
398b9c1b51eSKate Stone void SBBreakpoint::SetThreadName(const char *thread_name) {
399baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadName, (const char *),
400baf5664fSJonas Devlieghere                      thread_name);
401baf5664fSJonas Devlieghere 
4026ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
4034838131bSGreg Clayton 
4046ac84034SPavel Labath   if (bkpt_sp) {
405b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
4066ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
4076ac84034SPavel Labath     bkpt_sp->GetOptions()->GetThreadSpec()->SetName(thread_name);
40862b02c61SJim Ingham   }
409af67cecdSGreg Clayton }
41062b02c61SJim Ingham 
411b9c1b51eSKate Stone const char *SBBreakpoint::GetThreadName() const {
412baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetThreadName);
413baf5664fSJonas Devlieghere 
414dbb0abbfSEugene Zelenko   const char *name = nullptr;
4156ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
4166ac84034SPavel Labath   if (bkpt_sp) {
417b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
4186ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
419b9c1b51eSKate Stone     const ThreadSpec *thread_spec =
4206ac84034SPavel Labath         bkpt_sp->GetOptions()->GetThreadSpecNoCreate();
421dbb0abbfSEugene Zelenko     if (thread_spec != nullptr)
4224838131bSGreg Clayton       name = thread_spec->GetName();
42362b02c61SJim Ingham   }
4244838131bSGreg Clayton 
4254838131bSGreg Clayton   return name;
42662b02c61SJim Ingham }
42762b02c61SJim Ingham 
428b9c1b51eSKate Stone void SBBreakpoint::SetQueueName(const char *queue_name) {
429baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetQueueName, (const char *),
430baf5664fSJonas Devlieghere                      queue_name);
431baf5664fSJonas Devlieghere 
4326ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
4336ac84034SPavel Labath   if (bkpt_sp) {
434b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
4356ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
4366ac84034SPavel Labath     bkpt_sp->GetOptions()->GetThreadSpec()->SetQueueName(queue_name);
43762b02c61SJim Ingham   }
438af67cecdSGreg Clayton }
43962b02c61SJim Ingham 
440b9c1b51eSKate Stone const char *SBBreakpoint::GetQueueName() const {
441baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetQueueName);
442baf5664fSJonas Devlieghere 
443dbb0abbfSEugene Zelenko   const char *name = nullptr;
4446ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
4456ac84034SPavel Labath   if (bkpt_sp) {
446b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
4476ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
448b9c1b51eSKate Stone     const ThreadSpec *thread_spec =
4496ac84034SPavel Labath         bkpt_sp->GetOptions()->GetThreadSpecNoCreate();
450af67cecdSGreg Clayton     if (thread_spec)
4514838131bSGreg Clayton       name = thread_spec->GetQueueName();
45262b02c61SJim Ingham   }
4534838131bSGreg Clayton 
4544838131bSGreg Clayton   return name;
45562b02c61SJim Ingham }
45662b02c61SJim Ingham 
457b9c1b51eSKate Stone size_t SBBreakpoint::GetNumResolvedLocations() const {
458baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint,
459baf5664fSJonas Devlieghere                                    GetNumResolvedLocations);
460baf5664fSJonas Devlieghere 
4614838131bSGreg Clayton   size_t num_resolved = 0;
4626ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
4636ac84034SPavel Labath   if (bkpt_sp) {
464b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
4656ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
4666ac84034SPavel Labath     num_resolved = bkpt_sp->GetNumResolvedLocations();
467af67cecdSGreg Clayton   }
4684838131bSGreg Clayton   return num_resolved;
46930fdc8d8SChris Lattner }
47030fdc8d8SChris Lattner 
471b9c1b51eSKate Stone size_t SBBreakpoint::GetNumLocations() const {
472baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint, GetNumLocations);
473baf5664fSJonas Devlieghere 
4746ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
4754838131bSGreg Clayton   size_t num_locs = 0;
4766ac84034SPavel Labath   if (bkpt_sp) {
477b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
4786ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
4796ac84034SPavel Labath     num_locs = bkpt_sp->GetNumLocations();
480af67cecdSGreg Clayton   }
4814838131bSGreg Clayton   return num_locs;
48230fdc8d8SChris Lattner }
48330fdc8d8SChris Lattner 
48492d1960eSJim Ingham void SBBreakpoint::SetCommandLineCommands(SBStringList &commands) {
485baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, SetCommandLineCommands,
486baf5664fSJonas Devlieghere                      (lldb::SBStringList &), commands);
487baf5664fSJonas Devlieghere 
4886ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
4896ac84034SPavel Labath   if (!bkpt_sp)
49092d1960eSJim Ingham     return;
49192d1960eSJim Ingham   if (commands.GetSize() == 0)
49292d1960eSJim Ingham     return;
49392d1960eSJim Ingham 
49492d1960eSJim Ingham   std::lock_guard<std::recursive_mutex> guard(
4956ac84034SPavel Labath       bkpt_sp->GetTarget().GetAPIMutex());
49692d1960eSJim Ingham   std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
497f7e07256SJim Ingham       new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
49892d1960eSJim Ingham 
4996ac84034SPavel Labath   bkpt_sp->GetOptions()->SetCommandDataCallback(cmd_data_up);
50092d1960eSJim Ingham }
50192d1960eSJim Ingham 
50292d1960eSJim Ingham bool SBBreakpoint::GetCommandLineCommands(SBStringList &commands) {
503baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(bool, SBBreakpoint, GetCommandLineCommands,
504baf5664fSJonas Devlieghere                      (lldb::SBStringList &), commands);
505baf5664fSJonas Devlieghere 
5066ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
5076ac84034SPavel Labath   if (!bkpt_sp)
50892d1960eSJim Ingham     return false;
50992d1960eSJim Ingham   StringList command_list;
51092d1960eSJim Ingham   bool has_commands =
5116ac84034SPavel Labath       bkpt_sp->GetOptions()->GetCommandLineCallbacks(command_list);
51292d1960eSJim Ingham   if (has_commands)
51392d1960eSJim Ingham     commands.AppendList(command_list);
51492d1960eSJim Ingham   return has_commands;
51592d1960eSJim Ingham }
51692d1960eSJim Ingham 
517b9c1b51eSKate Stone bool SBBreakpoint::GetDescription(SBStream &s) {
518baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription, (lldb::SBStream &), s);
519baf5664fSJonas Devlieghere 
5206d1e4696SJim Ingham   return GetDescription(s, true);
5216d1e4696SJim Ingham }
5226d1e4696SJim Ingham 
5236d1e4696SJim Ingham bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) {
524baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription,
525baf5664fSJonas Devlieghere                      (lldb::SBStream &, bool), s, include_locations);
526baf5664fSJonas Devlieghere 
5276ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
5286ac84034SPavel Labath   if (bkpt_sp) {
529b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
5306ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
5316ac84034SPavel Labath     s.Printf("SBBreakpoint: id = %i, ", bkpt_sp->GetID());
5326ac84034SPavel Labath     bkpt_sp->GetResolverDescription(s.get());
5336ac84034SPavel Labath     bkpt_sp->GetFilterDescription(s.get());
5346d1e4696SJim Ingham     if (include_locations) {
5356ac84034SPavel Labath       const size_t num_locations = bkpt_sp->GetNumLocations();
536d01b2953SDaniel Malea       s.Printf(", locations = %" PRIu64, (uint64_t)num_locations);
5376d1e4696SJim Ingham     }
538dde9cff3SCaroline Tice     return true;
539dde9cff3SCaroline Tice   }
54005faeb71SGreg Clayton   s.Printf("No value");
54105faeb71SGreg Clayton   return false;
54205faeb71SGreg Clayton }
543dde9cff3SCaroline Tice 
544baf5664fSJonas Devlieghere SBError SBBreakpoint::AddLocation(SBAddress &address) {
545baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, AddLocation,
546baf5664fSJonas Devlieghere                      (lldb::SBAddress &), address);
547baf5664fSJonas Devlieghere 
5483815e702SJim Ingham   BreakpointSP bkpt_sp = GetSP();
5493815e702SJim Ingham   SBError error;
5503815e702SJim Ingham 
5513815e702SJim Ingham   if (!address.IsValid()) {
5523815e702SJim Ingham     error.SetErrorString("Can't add an invalid address.");
553baf5664fSJonas Devlieghere     return LLDB_RECORD_RESULT(error);
5543815e702SJim Ingham   }
5553815e702SJim Ingham 
5563815e702SJim Ingham   if (!bkpt_sp) {
5573815e702SJim Ingham     error.SetErrorString("No breakpoint to add a location to.");
558baf5664fSJonas Devlieghere     return LLDB_RECORD_RESULT(error);
5593815e702SJim Ingham   }
5603815e702SJim Ingham 
5613815e702SJim Ingham   if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) {
5623815e702SJim Ingham     error.SetErrorString("Only a scripted resolver can add locations.");
563baf5664fSJonas Devlieghere     return LLDB_RECORD_RESULT(error);
5643815e702SJim Ingham   }
5653815e702SJim Ingham 
5663815e702SJim Ingham   if (bkpt_sp->GetSearchFilter()->AddressPasses(address.ref()))
5673815e702SJim Ingham     bkpt_sp->AddLocation(address.ref());
568baf5664fSJonas Devlieghere   else {
5693815e702SJim Ingham     StreamString s;
5703815e702SJim Ingham     address.get()->Dump(&s, &bkpt_sp->GetTarget(),
5713815e702SJim Ingham                         Address::DumpStyleModuleWithFileAddress);
5723815e702SJim Ingham     error.SetErrorStringWithFormat("Address: %s didn't pass the filter.",
5733815e702SJim Ingham                                    s.GetData());
5743815e702SJim Ingham   }
575baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(error);
5763815e702SJim Ingham }
5773815e702SJim Ingham 
5780d7b0c96SJonas Devlieghere void SBBreakpoint ::SetCallback(SBBreakpointHitCallback callback, void *baton) {
5790d7b0c96SJonas Devlieghere   LLDB_RECORD_DUMMY(void, SBBreakpoint, SetCallback,
5800d7b0c96SJonas Devlieghere                     (lldb::SBBreakpointHitCallback, void *), callback, baton);
5810d7b0c96SJonas Devlieghere 
5826ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
583ceb6b139SCaroline Tice 
5846ac84034SPavel Labath   if (bkpt_sp) {
585b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
5866ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
58730fdc8d8SChris Lattner     BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
588b842f2ecSJim Ingham     bkpt_sp->SetCallback(SBBreakpointCallbackBaton
589b842f2ecSJim Ingham       ::PrivateBreakpointHitCallback, baton_sp,
5906ac84034SPavel Labath                          false);
59130fdc8d8SChris Lattner   }
59230fdc8d8SChris Lattner }
59330fdc8d8SChris Lattner 
594b9c1b51eSKate Stone void SBBreakpoint::SetScriptCallbackFunction(
595b9c1b51eSKate Stone   const char *callback_function_name) {
596baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(void, SBBreakpoint, SetScriptCallbackFunction,
597baf5664fSJonas Devlieghere                    (const char *), callback_function_name);
598738af7a6SJim Ingham   SBStructuredData empty_args;
599738af7a6SJim Ingham   SetScriptCallbackFunction(callback_function_name, empty_args);
600738af7a6SJim Ingham }
601baf5664fSJonas Devlieghere 
602738af7a6SJim Ingham SBError SBBreakpoint::SetScriptCallbackFunction(
603738af7a6SJim Ingham     const char *callback_function_name,
604738af7a6SJim Ingham     SBStructuredData &extra_args) {
605738af7a6SJim Ingham   LLDB_RECORD_METHOD(SBError, SBBreakpoint, SetScriptCallbackFunction,
606738af7a6SJim Ingham   (const char *, SBStructuredData &), callback_function_name, extra_args);
607738af7a6SJim Ingham   SBError sb_error;
6086ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
609d80102e4SJim Ingham 
6106ac84034SPavel Labath   if (bkpt_sp) {
611738af7a6SJim Ingham     Status error;
612b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
6136ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
6146ac84034SPavel Labath     BreakpointOptions *bp_options = bkpt_sp->GetOptions();
615738af7a6SJim Ingham     error = bkpt_sp->GetTarget()
616b9c1b51eSKate Stone         .GetDebugger()
617b9c1b51eSKate Stone         .GetScriptInterpreter()
618b9c1b51eSKate Stone         ->SetBreakpointCommandCallbackFunction(bp_options,
619738af7a6SJim Ingham                                                callback_function_name,
620738af7a6SJim Ingham                                                extra_args.m_impl_up
621738af7a6SJim Ingham                                                    ->GetObjectSP());
622738af7a6SJim Ingham     sb_error.SetError(error);
623738af7a6SJim Ingham   } else
624738af7a6SJim Ingham     sb_error.SetErrorString("invalid breakpoint");
625738af7a6SJim Ingham 
626738af7a6SJim Ingham   return LLDB_RECORD_RESULT(sb_error);
627d80102e4SJim Ingham }
628d80102e4SJim Ingham 
629b9c1b51eSKate Stone SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) {
630baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody,
631baf5664fSJonas Devlieghere                      (const char *), callback_body_text);
632baf5664fSJonas Devlieghere 
6336ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
634d80102e4SJim Ingham 
635d80102e4SJim Ingham   SBError sb_error;
6366ac84034SPavel Labath   if (bkpt_sp) {
637b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
6386ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
6396ac84034SPavel Labath     BreakpointOptions *bp_options = bkpt_sp->GetOptions();
64097206d57SZachary Turner     Status error =
6416ac84034SPavel Labath         bkpt_sp->GetTarget()
642b9c1b51eSKate Stone             .GetDebugger()
643b9c1b51eSKate Stone             .GetScriptInterpreter()
644b9c1b51eSKate Stone             ->SetBreakpointCommandCallback(bp_options, callback_body_text);
645d80102e4SJim Ingham     sb_error.SetError(error);
646b9c1b51eSKate Stone   } else
647d80102e4SJim Ingham     sb_error.SetErrorString("invalid breakpoint");
648d80102e4SJim Ingham 
649baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(sb_error);
650d80102e4SJim Ingham }
65130fdc8d8SChris Lattner 
652b9c1b51eSKate Stone bool SBBreakpoint::AddName(const char *new_name) {
653baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(bool, SBBreakpoint, AddName, (const char *), new_name);
654baf5664fSJonas Devlieghere 
655f70cad26SMed Ismail Bennani   SBError status = AddNameWithErrorHandling(new_name);
656f70cad26SMed Ismail Bennani   return status.Success();
657f70cad26SMed Ismail Bennani }
658f70cad26SMed Ismail Bennani 
659f70cad26SMed Ismail Bennani SBError SBBreakpoint::AddNameWithErrorHandling(const char *new_name) {
660f70cad26SMed Ismail Bennani   LLDB_RECORD_METHOD(SBError, SBBreakpoint, AddNameWithErrorHandling,
661f70cad26SMed Ismail Bennani                      (const char *), new_name);
662f70cad26SMed Ismail Bennani 
6636ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
6645e09c8c3SJim Ingham 
665f70cad26SMed Ismail Bennani   SBError status;
6666ac84034SPavel Labath   if (bkpt_sp) {
667b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
6686ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
669f70cad26SMed Ismail Bennani     Status error;
670b842f2ecSJim Ingham     bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name, error);
671f70cad26SMed Ismail Bennani     status.SetError(error);
672f70cad26SMed Ismail Bennani   } else {
673f70cad26SMed Ismail Bennani     status.SetErrorString("invalid breakpoint");
674b842f2ecSJim Ingham   }
6755e09c8c3SJim Ingham 
676*d9d992bbSJonas Devlieghere   return LLDB_RECORD_RESULT(status);
6775e09c8c3SJim Ingham }
6785e09c8c3SJim Ingham 
679b9c1b51eSKate Stone void SBBreakpoint::RemoveName(const char *name_to_remove) {
680baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, RemoveName, (const char *),
681baf5664fSJonas Devlieghere                      name_to_remove);
682baf5664fSJonas Devlieghere 
6836ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
6845e09c8c3SJim Ingham 
6856ac84034SPavel Labath   if (bkpt_sp) {
686b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
6876ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
688b842f2ecSJim Ingham     bkpt_sp->GetTarget().RemoveNameFromBreakpoint(bkpt_sp,
689b842f2ecSJim Ingham                                                   ConstString(name_to_remove));
6905e09c8c3SJim Ingham   }
6915e09c8c3SJim Ingham }
6925e09c8c3SJim Ingham 
693b9c1b51eSKate Stone bool SBBreakpoint::MatchesName(const char *name) {
694baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(bool, SBBreakpoint, MatchesName, (const char *), name);
695baf5664fSJonas Devlieghere 
6966ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
6975e09c8c3SJim Ingham 
6986ac84034SPavel Labath   if (bkpt_sp) {
699b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
7006ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
7016ac84034SPavel Labath     return bkpt_sp->MatchesName(name);
7025e09c8c3SJim Ingham   }
7035e09c8c3SJim Ingham 
7045e09c8c3SJim Ingham   return false;
7055e09c8c3SJim Ingham }
7065e09c8c3SJim Ingham 
707b9c1b51eSKate Stone void SBBreakpoint::GetNames(SBStringList &names) {
708baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &),
709baf5664fSJonas Devlieghere                      names);
710baf5664fSJonas Devlieghere 
7116ac84034SPavel Labath   BreakpointSP bkpt_sp = GetSP();
7125e09c8c3SJim Ingham 
7136ac84034SPavel Labath   if (bkpt_sp) {
714b9c1b51eSKate Stone     std::lock_guard<std::recursive_mutex> guard(
7156ac84034SPavel Labath         bkpt_sp->GetTarget().GetAPIMutex());
7165e09c8c3SJim Ingham     std::vector<std::string> names_vec;
7176ac84034SPavel Labath     bkpt_sp->GetNames(names_vec);
718b9c1b51eSKate Stone     for (std::string name : names_vec) {
7195e09c8c3SJim Ingham       names.AppendString(name.c_str());
7205e09c8c3SJim Ingham     }
7215e09c8c3SJim Ingham   }
7225e09c8c3SJim Ingham }
7235e09c8c3SJim Ingham 
724b9c1b51eSKate Stone bool SBBreakpoint::EventIsBreakpointEvent(const lldb::SBEvent &event) {
725baf5664fSJonas Devlieghere   LLDB_RECORD_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent,
726baf5664fSJonas Devlieghere                             (const lldb::SBEvent &), event);
727baf5664fSJonas Devlieghere 
728b9c1b51eSKate Stone   return Breakpoint::BreakpointEventData::GetEventDataFromEvent(event.get()) !=
729b9c1b51eSKate Stone          nullptr;
730e6bc6cb9SJim Ingham }
731e6bc6cb9SJim Ingham 
7329fed0d85SGreg Clayton BreakpointEventType
733b9c1b51eSKate Stone SBBreakpoint::GetBreakpointEventTypeFromEvent(const SBEvent &event) {
734baf5664fSJonas Devlieghere   LLDB_RECORD_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint,
735baf5664fSJonas Devlieghere                             GetBreakpointEventTypeFromEvent,
736baf5664fSJonas Devlieghere                             (const lldb::SBEvent &), event);
737baf5664fSJonas Devlieghere 
7389fed0d85SGreg Clayton   if (event.IsValid())
739b9c1b51eSKate Stone     return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent(
740b9c1b51eSKate Stone         event.GetSP());
7419fed0d85SGreg Clayton   return eBreakpointEventTypeInvalidType;
7429fed0d85SGreg Clayton }
7439fed0d85SGreg Clayton 
744b9c1b51eSKate Stone SBBreakpoint SBBreakpoint::GetBreakpointFromEvent(const lldb::SBEvent &event) {
745baf5664fSJonas Devlieghere   LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint,
746baf5664fSJonas Devlieghere                             GetBreakpointFromEvent, (const lldb::SBEvent &),
747baf5664fSJonas Devlieghere                             event);
748baf5664fSJonas Devlieghere 
7499fed0d85SGreg Clayton   if (event.IsValid())
750baf5664fSJonas Devlieghere     return LLDB_RECORD_RESULT(
751baf5664fSJonas Devlieghere         SBBreakpoint(Breakpoint::BreakpointEventData::GetBreakpointFromEvent(
752baf5664fSJonas Devlieghere             event.GetSP())));
753baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(SBBreakpoint());
7549fed0d85SGreg Clayton }
7559fed0d85SGreg Clayton 
7569fed0d85SGreg Clayton SBBreakpointLocation
757b9c1b51eSKate Stone SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
758b9c1b51eSKate Stone                                                     uint32_t loc_idx) {
759baf5664fSJonas Devlieghere   LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
760baf5664fSJonas Devlieghere                             GetBreakpointLocationAtIndexFromEvent,
761baf5664fSJonas Devlieghere                             (const lldb::SBEvent &, uint32_t), event, loc_idx);
762baf5664fSJonas Devlieghere 
7639fed0d85SGreg Clayton   SBBreakpointLocation sb_breakpoint_loc;
7649fed0d85SGreg Clayton   if (event.IsValid())
765b9c1b51eSKate Stone     sb_breakpoint_loc.SetLocation(
766b9c1b51eSKate Stone         Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent(
767b9c1b51eSKate Stone             event.GetSP(), loc_idx));
768baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(sb_breakpoint_loc);
7699fed0d85SGreg Clayton }
7709fed0d85SGreg Clayton 
771e6bc6cb9SJim Ingham uint32_t
772b9c1b51eSKate Stone SBBreakpoint::GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event) {
773baf5664fSJonas Devlieghere   LLDB_RECORD_STATIC_METHOD(uint32_t, SBBreakpoint,
774baf5664fSJonas Devlieghere                             GetNumBreakpointLocationsFromEvent,
775baf5664fSJonas Devlieghere                             (const lldb::SBEvent &), event);
776baf5664fSJonas Devlieghere 
777e6bc6cb9SJim Ingham   uint32_t num_locations = 0;
778e6bc6cb9SJim Ingham   if (event.IsValid())
779b9c1b51eSKate Stone     num_locations =
780b9c1b51eSKate Stone         (Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent(
781b9c1b51eSKate Stone             event.GetSP()));
782e6bc6cb9SJim Ingham   return num_locations;
783e6bc6cb9SJim Ingham }
78401f16664SJim Ingham 
785e103ae92SJonas Devlieghere bool SBBreakpoint::IsHardware() const {
786baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsHardware);
787baf5664fSJonas Devlieghere 
788e103ae92SJonas Devlieghere   BreakpointSP bkpt_sp = GetSP();
789e103ae92SJonas Devlieghere   if (bkpt_sp)
790e103ae92SJonas Devlieghere     return bkpt_sp->IsHardware();
791e103ae92SJonas Devlieghere   return false;
792e103ae92SJonas Devlieghere }
793e103ae92SJonas Devlieghere 
7946ac84034SPavel Labath BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); }
7956ac84034SPavel Labath 
79601f16664SJim Ingham // This is simple collection of breakpoint id's and their target.
797653e3f4eSTodd Fiala class SBBreakpointListImpl {
79801f16664SJim Ingham public:
799653e3f4eSTodd Fiala   SBBreakpointListImpl(lldb::TargetSP target_sp) : m_target_wp() {
800653e3f4eSTodd Fiala     if (target_sp && target_sp->IsValid())
801653e3f4eSTodd Fiala       m_target_wp = target_sp;
80201f16664SJim Ingham   }
80301f16664SJim Ingham 
80401f16664SJim Ingham   ~SBBreakpointListImpl() = default;
80501f16664SJim Ingham 
80601f16664SJim Ingham   size_t GetSize() { return m_break_ids.size(); }
80701f16664SJim Ingham 
80801f16664SJim Ingham   BreakpointSP GetBreakpointAtIndex(size_t idx) {
80901f16664SJim Ingham     if (idx >= m_break_ids.size())
81001f16664SJim Ingham       return BreakpointSP();
81101f16664SJim Ingham     TargetSP target_sp = m_target_wp.lock();
81201f16664SJim Ingham     if (!target_sp)
81301f16664SJim Ingham       return BreakpointSP();
81401f16664SJim Ingham     lldb::break_id_t bp_id = m_break_ids[idx];
81501f16664SJim Ingham     return target_sp->GetBreakpointList().FindBreakpointByID(bp_id);
81601f16664SJim Ingham   }
81701f16664SJim Ingham 
8186d1e4696SJim Ingham   BreakpointSP FindBreakpointByID(lldb::break_id_t desired_id) {
8196d1e4696SJim Ingham     TargetSP target_sp = m_target_wp.lock();
8206d1e4696SJim Ingham     if (!target_sp)
8216d1e4696SJim Ingham       return BreakpointSP();
8226d1e4696SJim Ingham 
8236d1e4696SJim Ingham     for (lldb::break_id_t &break_id : m_break_ids) {
8246d1e4696SJim Ingham       if (break_id == desired_id)
8256d1e4696SJim Ingham         return target_sp->GetBreakpointList().FindBreakpointByID(break_id);
8266d1e4696SJim Ingham     }
8276d1e4696SJim Ingham     return BreakpointSP();
8286d1e4696SJim Ingham   }
8296d1e4696SJim Ingham 
8306ac84034SPavel Labath   bool Append(BreakpointSP bkpt) {
83101f16664SJim Ingham     TargetSP target_sp = m_target_wp.lock();
8326ac84034SPavel Labath     if (!target_sp || !bkpt)
83301f16664SJim Ingham       return false;
8346ac84034SPavel Labath     if (bkpt->GetTargetSP() != target_sp)
83501f16664SJim Ingham       return false;
8366ac84034SPavel Labath     m_break_ids.push_back(bkpt->GetID());
83701f16664SJim Ingham     return true;
83801f16664SJim Ingham   }
83901f16664SJim Ingham 
8406ac84034SPavel Labath   bool AppendIfUnique(BreakpointSP bkpt) {
84101f16664SJim Ingham     TargetSP target_sp = m_target_wp.lock();
8426ac84034SPavel Labath     if (!target_sp || !bkpt)
84301f16664SJim Ingham       return false;
8446ac84034SPavel Labath     if (bkpt->GetTargetSP() != target_sp)
84501f16664SJim Ingham       return false;
8466ac84034SPavel Labath     lldb::break_id_t bp_id = bkpt->GetID();
84701f16664SJim Ingham     if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) ==
84801f16664SJim Ingham         m_break_ids.end())
84901f16664SJim Ingham       return false;
85001f16664SJim Ingham 
8516ac84034SPavel Labath     m_break_ids.push_back(bkpt->GetID());
85201f16664SJim Ingham     return true;
85301f16664SJim Ingham   }
85401f16664SJim Ingham 
85501f16664SJim Ingham   bool AppendByID(lldb::break_id_t id) {
85601f16664SJim Ingham     TargetSP target_sp = m_target_wp.lock();
85701f16664SJim Ingham     if (!target_sp)
85801f16664SJim Ingham       return false;
85901f16664SJim Ingham     if (id == LLDB_INVALID_BREAK_ID)
86001f16664SJim Ingham       return false;
86101f16664SJim Ingham     m_break_ids.push_back(id);
86201f16664SJim Ingham     return true;
86301f16664SJim Ingham   }
86401f16664SJim Ingham 
86501f16664SJim Ingham   void Clear() { m_break_ids.clear(); }
86601f16664SJim Ingham 
86701f16664SJim Ingham   void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_list) {
86801f16664SJim Ingham     for (lldb::break_id_t id : m_break_ids) {
86901f16664SJim Ingham       bp_list.AddBreakpointID(BreakpointID(id));
87001f16664SJim Ingham     }
87101f16664SJim Ingham   }
87201f16664SJim Ingham 
87301f16664SJim Ingham   TargetSP GetTarget() { return m_target_wp.lock(); }
87401f16664SJim Ingham 
87501f16664SJim Ingham private:
87601f16664SJim Ingham   std::vector<lldb::break_id_t> m_break_ids;
87701f16664SJim Ingham   TargetWP m_target_wp;
87801f16664SJim Ingham };
87901f16664SJim Ingham 
88001f16664SJim Ingham SBBreakpointList::SBBreakpointList(SBTarget &target)
881baf5664fSJonas Devlieghere     : m_opaque_sp(new SBBreakpointListImpl(target.GetSP())) {
882baf5664fSJonas Devlieghere   LLDB_RECORD_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &), target);
883baf5664fSJonas Devlieghere }
88401f16664SJim Ingham 
885866b7a65SJonas Devlieghere SBBreakpointList::~SBBreakpointList() = default;
88601f16664SJim Ingham 
88701f16664SJim Ingham size_t SBBreakpointList::GetSize() const {
888baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpointList, GetSize);
889baf5664fSJonas Devlieghere 
89001f16664SJim Ingham   if (!m_opaque_sp)
89101f16664SJim Ingham     return 0;
89201f16664SJim Ingham   else
89301f16664SJim Ingham     return m_opaque_sp->GetSize();
89401f16664SJim Ingham }
89501f16664SJim Ingham 
89601f16664SJim Ingham SBBreakpoint SBBreakpointList::GetBreakpointAtIndex(size_t idx) {
897baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, GetBreakpointAtIndex,
898baf5664fSJonas Devlieghere                      (size_t), idx);
899baf5664fSJonas Devlieghere 
90001f16664SJim Ingham   if (!m_opaque_sp)
901baf5664fSJonas Devlieghere     return LLDB_RECORD_RESULT(SBBreakpoint());
90201f16664SJim Ingham 
90301f16664SJim Ingham   BreakpointSP bkpt_sp = m_opaque_sp->GetBreakpointAtIndex(idx);
904baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp));
90501f16664SJim Ingham }
90601f16664SJim Ingham 
9076d1e4696SJim Ingham SBBreakpoint SBBreakpointList::FindBreakpointByID(lldb::break_id_t id) {
908baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, FindBreakpointByID,
909baf5664fSJonas Devlieghere                      (lldb::break_id_t), id);
910baf5664fSJonas Devlieghere 
9116d1e4696SJim Ingham   if (!m_opaque_sp)
912baf5664fSJonas Devlieghere     return LLDB_RECORD_RESULT(SBBreakpoint());
9136d1e4696SJim Ingham   BreakpointSP bkpt_sp = m_opaque_sp->FindBreakpointByID(id);
914baf5664fSJonas Devlieghere   return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp));
9156d1e4696SJim Ingham }
9166d1e4696SJim Ingham 
91701f16664SJim Ingham void SBBreakpointList::Append(const SBBreakpoint &sb_bkpt) {
918baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpointList, Append,
919baf5664fSJonas Devlieghere                      (const lldb::SBBreakpoint &), sb_bkpt);
920baf5664fSJonas Devlieghere 
92101f16664SJim Ingham   if (!sb_bkpt.IsValid())
92201f16664SJim Ingham     return;
92301f16664SJim Ingham   if (!m_opaque_sp)
92401f16664SJim Ingham     return;
9256ac84034SPavel Labath   m_opaque_sp->Append(sb_bkpt.m_opaque_wp.lock());
92601f16664SJim Ingham }
92701f16664SJim Ingham 
92801f16664SJim Ingham void SBBreakpointList::AppendByID(lldb::break_id_t id) {
929baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(void, SBBreakpointList, AppendByID, (lldb::break_id_t),
930baf5664fSJonas Devlieghere                      id);
931baf5664fSJonas Devlieghere 
93201f16664SJim Ingham   if (!m_opaque_sp)
93301f16664SJim Ingham     return;
93401f16664SJim Ingham   m_opaque_sp->AppendByID(id);
93501f16664SJim Ingham }
93601f16664SJim Ingham 
93701f16664SJim Ingham bool SBBreakpointList::AppendIfUnique(const SBBreakpoint &sb_bkpt) {
938baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD(bool, SBBreakpointList, AppendIfUnique,
939baf5664fSJonas Devlieghere                      (const lldb::SBBreakpoint &), sb_bkpt);
940baf5664fSJonas Devlieghere 
94101f16664SJim Ingham   if (!sb_bkpt.IsValid())
94201f16664SJim Ingham     return false;
94301f16664SJim Ingham   if (!m_opaque_sp)
94401f16664SJim Ingham     return false;
9456ac84034SPavel Labath   return m_opaque_sp->AppendIfUnique(sb_bkpt.GetSP());
94601f16664SJim Ingham }
94701f16664SJim Ingham 
94801f16664SJim Ingham void SBBreakpointList::Clear() {
949baf5664fSJonas Devlieghere   LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpointList, Clear);
950baf5664fSJonas Devlieghere 
95101f16664SJim Ingham   if (m_opaque_sp)
95201f16664SJim Ingham     m_opaque_sp->Clear();
95301f16664SJim Ingham }
95401f16664SJim Ingham 
95501f16664SJim Ingham void SBBreakpointList::CopyToBreakpointIDList(
95601f16664SJim Ingham     lldb_private::BreakpointIDList &bp_id_list) {
95701f16664SJim Ingham   if (m_opaque_sp)
95801f16664SJim Ingham     m_opaque_sp->CopyToBreakpointIDList(bp_id_list);
95901f16664SJim Ingham }
960ae211eceSMichal Gorny 
961ae211eceSMichal Gorny namespace lldb_private {
962ae211eceSMichal Gorny namespace repro {
963ae211eceSMichal Gorny 
964ae211eceSMichal Gorny template <>
965ae211eceSMichal Gorny void RegisterMethods<SBBreakpoint>(Registry &R) {
966ae211eceSMichal Gorny   LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, ());
967ae211eceSMichal Gorny   LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &));
968ae211eceSMichal Gorny   LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &));
969ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(const lldb::SBBreakpoint &,
970ae211eceSMichal Gorny                        SBBreakpoint, operator=,(const lldb::SBBreakpoint &));
971ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool,
972ae211eceSMichal Gorny                        SBBreakpoint, operator==,(const lldb::SBBreakpoint &));
973ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool,
974ae211eceSMichal Gorny                        SBBreakpoint, operator!=,(const lldb::SBBreakpoint &));
975ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(lldb::break_id_t, SBBreakpoint, GetID, ());
976ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsValid, ());
977ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, operator bool, ());
978ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, ClearAllBreakpointSites, ());
979ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
980ae211eceSMichal Gorny                        FindLocationByAddress, (lldb::addr_t));
981ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::break_id_t, SBBreakpoint,
982ae211eceSMichal Gorny                        FindLocationIDByAddress, (lldb::addr_t));
983ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
984ae211eceSMichal Gorny                        FindLocationByID, (lldb::break_id_t));
985ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
986ae211eceSMichal Gorny                        GetLocationAtIndex, (uint32_t));
987ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetEnabled, (bool));
988ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsEnabled, ());
989ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetOneShot, (bool));
990ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsOneShot, ());
991ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsInternal, ());
992ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t));
993ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCondition, (const char *));
994ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(const char *, SBBreakpoint, GetCondition, ());
995ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetAutoContinue, (bool));
996ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetAutoContinue, ());
997ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetHitCount, ());
998ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetIgnoreCount, ());
999ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t));
1000ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::tid_t, SBBreakpoint, GetThreadID, ());
1001ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t));
1002ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetThreadIndex, ());
1003ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadName, (const char *));
1004ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetThreadName, ());
1005ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetQueueName, (const char *));
1006ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetQueueName, ());
1007ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumResolvedLocations,
1008ae211eceSMichal Gorny                              ());
1009ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumLocations, ());
1010ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCommandLineCommands,
1011ae211eceSMichal Gorny                        (lldb::SBStringList &));
1012ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetCommandLineCommands,
1013ae211eceSMichal Gorny                        (lldb::SBStringList &));
1014ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription,
1015ae211eceSMichal Gorny                        (lldb::SBStream &));
1016ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription,
1017ae211eceSMichal Gorny                        (lldb::SBStream &, bool));
1018ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddLocation,
1019ae211eceSMichal Gorny                        (lldb::SBAddress &));
1020ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetScriptCallbackFunction,
1021ae211eceSMichal Gorny                        (const char *));
1022738af7a6SJim Ingham   LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackFunction,
1023738af7a6SJim Ingham                        (const char *, SBStructuredData &));
1024ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody,
1025ae211eceSMichal Gorny                        (const char *));
1026ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, AddName, (const char *));
1027f70cad26SMed Ismail Bennani   LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddNameWithErrorHandling,
1028f70cad26SMed Ismail Bennani                        (const char *));
1029ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, RemoveName, (const char *));
1030ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpoint, MatchesName, (const char *));
1031ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &));
1032ae211eceSMichal Gorny   LLDB_REGISTER_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent,
1033ae211eceSMichal Gorny                               (const lldb::SBEvent &));
1034ae211eceSMichal Gorny   LLDB_REGISTER_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint,
1035ae211eceSMichal Gorny                               GetBreakpointEventTypeFromEvent,
1036ae211eceSMichal Gorny                               (const lldb::SBEvent &));
1037ae211eceSMichal Gorny   LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint,
1038ae211eceSMichal Gorny                               GetBreakpointFromEvent,
1039ae211eceSMichal Gorny                               (const lldb::SBEvent &));
1040ae211eceSMichal Gorny   LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
1041ae211eceSMichal Gorny                               GetBreakpointLocationAtIndexFromEvent,
1042ae211eceSMichal Gorny                               (const lldb::SBEvent &, uint32_t));
1043ae211eceSMichal Gorny   LLDB_REGISTER_STATIC_METHOD(uint32_t, SBBreakpoint,
1044ae211eceSMichal Gorny                               GetNumBreakpointLocationsFromEvent,
1045ae211eceSMichal Gorny                               (const lldb::SBEvent &));
1046ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsHardware, ());
1047ae211eceSMichal Gorny }
1048ae211eceSMichal Gorny 
1049ae211eceSMichal Gorny template <>
1050ae211eceSMichal Gorny void RegisterMethods<SBBreakpointList>(Registry &R) {
1051ae211eceSMichal Gorny   LLDB_REGISTER_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &));
1052ae211eceSMichal Gorny   LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpointList, GetSize, ());
1053ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList,
1054ae211eceSMichal Gorny                        GetBreakpointAtIndex, (size_t));
1055ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList,
1056ae211eceSMichal Gorny                        FindBreakpointByID, (lldb::break_id_t));
1057ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpointList, Append,
1058ae211eceSMichal Gorny                        (const lldb::SBBreakpoint &));
1059ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpointList, AppendByID,
1060ae211eceSMichal Gorny                        (lldb::break_id_t));
1061ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(bool, SBBreakpointList, AppendIfUnique,
1062ae211eceSMichal Gorny                        (const lldb::SBBreakpoint &));
1063ae211eceSMichal Gorny   LLDB_REGISTER_METHOD(void, SBBreakpointList, Clear, ());
1064ae211eceSMichal Gorny }
1065ae211eceSMichal Gorny 
1066ae211eceSMichal Gorny }
1067ae211eceSMichal Gorny }
1068