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 578*4da8fa45SMed Ismail Bennani SBStructuredData SBBreakpoint::SerializeToStructuredData() { 579*4da8fa45SMed Ismail Bennani LLDB_RECORD_METHOD_NO_ARGS(lldb::SBStructuredData, SBBreakpoint, 580*4da8fa45SMed Ismail Bennani SerializeToStructuredData); 581*4da8fa45SMed Ismail Bennani 582*4da8fa45SMed Ismail Bennani SBStructuredData data; 583*4da8fa45SMed Ismail Bennani BreakpointSP bkpt_sp = GetSP(); 584*4da8fa45SMed Ismail Bennani 585*4da8fa45SMed Ismail Bennani if (!bkpt_sp) 586*4da8fa45SMed Ismail Bennani return LLDB_RECORD_RESULT(data); 587*4da8fa45SMed Ismail Bennani 588*4da8fa45SMed Ismail Bennani StructuredData::ObjectSP bkpt_dict = bkpt_sp->SerializeToStructuredData(); 589*4da8fa45SMed Ismail Bennani data.m_impl_up->SetObjectSP(bkpt_dict); 590*4da8fa45SMed Ismail Bennani return LLDB_RECORD_RESULT(data); 591*4da8fa45SMed Ismail Bennani } 592*4da8fa45SMed Ismail Bennani 5930d7b0c96SJonas Devlieghere void SBBreakpoint::SetCallback(SBBreakpointHitCallback callback, void *baton) { 5940d7b0c96SJonas Devlieghere LLDB_RECORD_DUMMY(void, SBBreakpoint, SetCallback, 5950d7b0c96SJonas Devlieghere (lldb::SBBreakpointHitCallback, void *), callback, baton); 5960d7b0c96SJonas Devlieghere 5976ac84034SPavel Labath BreakpointSP bkpt_sp = GetSP(); 598ceb6b139SCaroline Tice 5996ac84034SPavel Labath if (bkpt_sp) { 600b9c1b51eSKate Stone std::lock_guard<std::recursive_mutex> guard( 6016ac84034SPavel Labath bkpt_sp->GetTarget().GetAPIMutex()); 60230fdc8d8SChris Lattner BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton)); 603b842f2ecSJim Ingham bkpt_sp->SetCallback(SBBreakpointCallbackBaton 604b842f2ecSJim Ingham ::PrivateBreakpointHitCallback, baton_sp, 6056ac84034SPavel Labath false); 60630fdc8d8SChris Lattner } 60730fdc8d8SChris Lattner } 60830fdc8d8SChris Lattner 609b9c1b51eSKate Stone void SBBreakpoint::SetScriptCallbackFunction( 610b9c1b51eSKate Stone const char *callback_function_name) { 611baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(void, SBBreakpoint, SetScriptCallbackFunction, 612baf5664fSJonas Devlieghere (const char *), callback_function_name); 613738af7a6SJim Ingham SBStructuredData empty_args; 614738af7a6SJim Ingham SetScriptCallbackFunction(callback_function_name, empty_args); 615738af7a6SJim Ingham } 616baf5664fSJonas Devlieghere 617738af7a6SJim Ingham SBError SBBreakpoint::SetScriptCallbackFunction( 618738af7a6SJim Ingham const char *callback_function_name, 619738af7a6SJim Ingham SBStructuredData &extra_args) { 620738af7a6SJim Ingham LLDB_RECORD_METHOD(SBError, SBBreakpoint, SetScriptCallbackFunction, 621738af7a6SJim Ingham (const char *, SBStructuredData &), callback_function_name, extra_args); 622738af7a6SJim Ingham SBError sb_error; 6236ac84034SPavel Labath BreakpointSP bkpt_sp = GetSP(); 624d80102e4SJim Ingham 6256ac84034SPavel Labath if (bkpt_sp) { 626738af7a6SJim Ingham Status error; 627b9c1b51eSKate Stone std::lock_guard<std::recursive_mutex> guard( 6286ac84034SPavel Labath bkpt_sp->GetTarget().GetAPIMutex()); 6296ac84034SPavel Labath BreakpointOptions *bp_options = bkpt_sp->GetOptions(); 630738af7a6SJim Ingham error = bkpt_sp->GetTarget() 631b9c1b51eSKate Stone .GetDebugger() 632b9c1b51eSKate Stone .GetScriptInterpreter() 633b9c1b51eSKate Stone ->SetBreakpointCommandCallbackFunction(bp_options, 634738af7a6SJim Ingham callback_function_name, 635738af7a6SJim Ingham extra_args.m_impl_up 636738af7a6SJim Ingham ->GetObjectSP()); 637738af7a6SJim Ingham sb_error.SetError(error); 638738af7a6SJim Ingham } else 639738af7a6SJim Ingham sb_error.SetErrorString("invalid breakpoint"); 640738af7a6SJim Ingham 641738af7a6SJim Ingham return LLDB_RECORD_RESULT(sb_error); 642d80102e4SJim Ingham } 643d80102e4SJim Ingham 644b9c1b51eSKate Stone SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) { 645baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody, 646baf5664fSJonas Devlieghere (const char *), callback_body_text); 647baf5664fSJonas Devlieghere 6486ac84034SPavel Labath BreakpointSP bkpt_sp = GetSP(); 649d80102e4SJim Ingham 650d80102e4SJim Ingham SBError sb_error; 6516ac84034SPavel Labath if (bkpt_sp) { 652b9c1b51eSKate Stone std::lock_guard<std::recursive_mutex> guard( 6536ac84034SPavel Labath bkpt_sp->GetTarget().GetAPIMutex()); 6546ac84034SPavel Labath BreakpointOptions *bp_options = bkpt_sp->GetOptions(); 65597206d57SZachary Turner Status error = 6566ac84034SPavel Labath bkpt_sp->GetTarget() 657b9c1b51eSKate Stone .GetDebugger() 658b9c1b51eSKate Stone .GetScriptInterpreter() 659b9c1b51eSKate Stone ->SetBreakpointCommandCallback(bp_options, callback_body_text); 660d80102e4SJim Ingham sb_error.SetError(error); 661b9c1b51eSKate Stone } else 662d80102e4SJim Ingham sb_error.SetErrorString("invalid breakpoint"); 663d80102e4SJim Ingham 664baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT(sb_error); 665d80102e4SJim Ingham } 66630fdc8d8SChris Lattner 667b9c1b51eSKate Stone bool SBBreakpoint::AddName(const char *new_name) { 668baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(bool, SBBreakpoint, AddName, (const char *), new_name); 669baf5664fSJonas Devlieghere 670f70cad26SMed Ismail Bennani SBError status = AddNameWithErrorHandling(new_name); 671f70cad26SMed Ismail Bennani return status.Success(); 672f70cad26SMed Ismail Bennani } 673f70cad26SMed Ismail Bennani 674f70cad26SMed Ismail Bennani SBError SBBreakpoint::AddNameWithErrorHandling(const char *new_name) { 675f70cad26SMed Ismail Bennani LLDB_RECORD_METHOD(SBError, SBBreakpoint, AddNameWithErrorHandling, 676f70cad26SMed Ismail Bennani (const char *), new_name); 677f70cad26SMed Ismail Bennani 6786ac84034SPavel Labath BreakpointSP bkpt_sp = GetSP(); 6795e09c8c3SJim Ingham 680f70cad26SMed Ismail Bennani SBError status; 6816ac84034SPavel Labath if (bkpt_sp) { 682b9c1b51eSKate Stone std::lock_guard<std::recursive_mutex> guard( 6836ac84034SPavel Labath bkpt_sp->GetTarget().GetAPIMutex()); 684f70cad26SMed Ismail Bennani Status error; 685b842f2ecSJim Ingham bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name, error); 686f70cad26SMed Ismail Bennani status.SetError(error); 687f70cad26SMed Ismail Bennani } else { 688f70cad26SMed Ismail Bennani status.SetErrorString("invalid breakpoint"); 689b842f2ecSJim Ingham } 6905e09c8c3SJim Ingham 691d9d992bbSJonas Devlieghere return LLDB_RECORD_RESULT(status); 6925e09c8c3SJim Ingham } 6935e09c8c3SJim Ingham 694b9c1b51eSKate Stone void SBBreakpoint::RemoveName(const char *name_to_remove) { 695baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(void, SBBreakpoint, RemoveName, (const char *), 696baf5664fSJonas Devlieghere name_to_remove); 697baf5664fSJonas Devlieghere 6986ac84034SPavel Labath BreakpointSP bkpt_sp = GetSP(); 6995e09c8c3SJim Ingham 7006ac84034SPavel Labath if (bkpt_sp) { 701b9c1b51eSKate Stone std::lock_guard<std::recursive_mutex> guard( 7026ac84034SPavel Labath bkpt_sp->GetTarget().GetAPIMutex()); 703b842f2ecSJim Ingham bkpt_sp->GetTarget().RemoveNameFromBreakpoint(bkpt_sp, 704b842f2ecSJim Ingham ConstString(name_to_remove)); 7055e09c8c3SJim Ingham } 7065e09c8c3SJim Ingham } 7075e09c8c3SJim Ingham 708b9c1b51eSKate Stone bool SBBreakpoint::MatchesName(const char *name) { 709baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(bool, SBBreakpoint, MatchesName, (const char *), name); 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()); 7166ac84034SPavel Labath return bkpt_sp->MatchesName(name); 7175e09c8c3SJim Ingham } 7185e09c8c3SJim Ingham 7195e09c8c3SJim Ingham return false; 7205e09c8c3SJim Ingham } 7215e09c8c3SJim Ingham 722b9c1b51eSKate Stone void SBBreakpoint::GetNames(SBStringList &names) { 723baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &), 724baf5664fSJonas Devlieghere names); 725baf5664fSJonas Devlieghere 7266ac84034SPavel Labath BreakpointSP bkpt_sp = GetSP(); 7275e09c8c3SJim Ingham 7286ac84034SPavel Labath if (bkpt_sp) { 729b9c1b51eSKate Stone std::lock_guard<std::recursive_mutex> guard( 7306ac84034SPavel Labath bkpt_sp->GetTarget().GetAPIMutex()); 7315e09c8c3SJim Ingham std::vector<std::string> names_vec; 7326ac84034SPavel Labath bkpt_sp->GetNames(names_vec); 733b9c1b51eSKate Stone for (std::string name : names_vec) { 7345e09c8c3SJim Ingham names.AppendString(name.c_str()); 7355e09c8c3SJim Ingham } 7365e09c8c3SJim Ingham } 7375e09c8c3SJim Ingham } 7385e09c8c3SJim Ingham 739b9c1b51eSKate Stone bool SBBreakpoint::EventIsBreakpointEvent(const lldb::SBEvent &event) { 740baf5664fSJonas Devlieghere LLDB_RECORD_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent, 741baf5664fSJonas Devlieghere (const lldb::SBEvent &), event); 742baf5664fSJonas Devlieghere 743b9c1b51eSKate Stone return Breakpoint::BreakpointEventData::GetEventDataFromEvent(event.get()) != 744b9c1b51eSKate Stone nullptr; 745e6bc6cb9SJim Ingham } 746e6bc6cb9SJim Ingham 7479fed0d85SGreg Clayton BreakpointEventType 748b9c1b51eSKate Stone SBBreakpoint::GetBreakpointEventTypeFromEvent(const SBEvent &event) { 749baf5664fSJonas Devlieghere LLDB_RECORD_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint, 750baf5664fSJonas Devlieghere GetBreakpointEventTypeFromEvent, 751baf5664fSJonas Devlieghere (const lldb::SBEvent &), event); 752baf5664fSJonas Devlieghere 7539fed0d85SGreg Clayton if (event.IsValid()) 754b9c1b51eSKate Stone return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent( 755b9c1b51eSKate Stone event.GetSP()); 7569fed0d85SGreg Clayton return eBreakpointEventTypeInvalidType; 7579fed0d85SGreg Clayton } 7589fed0d85SGreg Clayton 759b9c1b51eSKate Stone SBBreakpoint SBBreakpoint::GetBreakpointFromEvent(const lldb::SBEvent &event) { 760baf5664fSJonas Devlieghere LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint, 761baf5664fSJonas Devlieghere GetBreakpointFromEvent, (const lldb::SBEvent &), 762baf5664fSJonas Devlieghere event); 763baf5664fSJonas Devlieghere 7649fed0d85SGreg Clayton if (event.IsValid()) 765baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT( 766baf5664fSJonas Devlieghere SBBreakpoint(Breakpoint::BreakpointEventData::GetBreakpointFromEvent( 767baf5664fSJonas Devlieghere event.GetSP()))); 768baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT(SBBreakpoint()); 7699fed0d85SGreg Clayton } 7709fed0d85SGreg Clayton 7719fed0d85SGreg Clayton SBBreakpointLocation 772b9c1b51eSKate Stone SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event, 773b9c1b51eSKate Stone uint32_t loc_idx) { 774baf5664fSJonas Devlieghere LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 775baf5664fSJonas Devlieghere GetBreakpointLocationAtIndexFromEvent, 776baf5664fSJonas Devlieghere (const lldb::SBEvent &, uint32_t), event, loc_idx); 777baf5664fSJonas Devlieghere 7789fed0d85SGreg Clayton SBBreakpointLocation sb_breakpoint_loc; 7799fed0d85SGreg Clayton if (event.IsValid()) 780b9c1b51eSKate Stone sb_breakpoint_loc.SetLocation( 781b9c1b51eSKate Stone Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent( 782b9c1b51eSKate Stone event.GetSP(), loc_idx)); 783baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT(sb_breakpoint_loc); 7849fed0d85SGreg Clayton } 7859fed0d85SGreg Clayton 786e6bc6cb9SJim Ingham uint32_t 787b9c1b51eSKate Stone SBBreakpoint::GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event) { 788baf5664fSJonas Devlieghere LLDB_RECORD_STATIC_METHOD(uint32_t, SBBreakpoint, 789baf5664fSJonas Devlieghere GetNumBreakpointLocationsFromEvent, 790baf5664fSJonas Devlieghere (const lldb::SBEvent &), event); 791baf5664fSJonas Devlieghere 792e6bc6cb9SJim Ingham uint32_t num_locations = 0; 793e6bc6cb9SJim Ingham if (event.IsValid()) 794b9c1b51eSKate Stone num_locations = 795b9c1b51eSKate Stone (Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent( 796b9c1b51eSKate Stone event.GetSP())); 797e6bc6cb9SJim Ingham return num_locations; 798e6bc6cb9SJim Ingham } 79901f16664SJim Ingham 800e103ae92SJonas Devlieghere bool SBBreakpoint::IsHardware() const { 801baf5664fSJonas Devlieghere LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsHardware); 802baf5664fSJonas Devlieghere 803e103ae92SJonas Devlieghere BreakpointSP bkpt_sp = GetSP(); 804e103ae92SJonas Devlieghere if (bkpt_sp) 805e103ae92SJonas Devlieghere return bkpt_sp->IsHardware(); 806e103ae92SJonas Devlieghere return false; 807e103ae92SJonas Devlieghere } 808e103ae92SJonas Devlieghere 8096ac84034SPavel Labath BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); } 8106ac84034SPavel Labath 81101f16664SJim Ingham // This is simple collection of breakpoint id's and their target. 812653e3f4eSTodd Fiala class SBBreakpointListImpl { 81301f16664SJim Ingham public: 814653e3f4eSTodd Fiala SBBreakpointListImpl(lldb::TargetSP target_sp) : m_target_wp() { 815653e3f4eSTodd Fiala if (target_sp && target_sp->IsValid()) 816653e3f4eSTodd Fiala m_target_wp = target_sp; 81701f16664SJim Ingham } 81801f16664SJim Ingham 81901f16664SJim Ingham ~SBBreakpointListImpl() = default; 82001f16664SJim Ingham 82101f16664SJim Ingham size_t GetSize() { return m_break_ids.size(); } 82201f16664SJim Ingham 82301f16664SJim Ingham BreakpointSP GetBreakpointAtIndex(size_t idx) { 82401f16664SJim Ingham if (idx >= m_break_ids.size()) 82501f16664SJim Ingham return BreakpointSP(); 82601f16664SJim Ingham TargetSP target_sp = m_target_wp.lock(); 82701f16664SJim Ingham if (!target_sp) 82801f16664SJim Ingham return BreakpointSP(); 82901f16664SJim Ingham lldb::break_id_t bp_id = m_break_ids[idx]; 83001f16664SJim Ingham return target_sp->GetBreakpointList().FindBreakpointByID(bp_id); 83101f16664SJim Ingham } 83201f16664SJim Ingham 8336d1e4696SJim Ingham BreakpointSP FindBreakpointByID(lldb::break_id_t desired_id) { 8346d1e4696SJim Ingham TargetSP target_sp = m_target_wp.lock(); 8356d1e4696SJim Ingham if (!target_sp) 8366d1e4696SJim Ingham return BreakpointSP(); 8376d1e4696SJim Ingham 8386d1e4696SJim Ingham for (lldb::break_id_t &break_id : m_break_ids) { 8396d1e4696SJim Ingham if (break_id == desired_id) 8406d1e4696SJim Ingham return target_sp->GetBreakpointList().FindBreakpointByID(break_id); 8416d1e4696SJim Ingham } 8426d1e4696SJim Ingham return BreakpointSP(); 8436d1e4696SJim Ingham } 8446d1e4696SJim Ingham 8456ac84034SPavel Labath bool Append(BreakpointSP bkpt) { 84601f16664SJim Ingham TargetSP target_sp = m_target_wp.lock(); 8476ac84034SPavel Labath if (!target_sp || !bkpt) 84801f16664SJim Ingham return false; 8496ac84034SPavel Labath if (bkpt->GetTargetSP() != target_sp) 85001f16664SJim Ingham return false; 8516ac84034SPavel Labath m_break_ids.push_back(bkpt->GetID()); 85201f16664SJim Ingham return true; 85301f16664SJim Ingham } 85401f16664SJim Ingham 8556ac84034SPavel Labath bool AppendIfUnique(BreakpointSP bkpt) { 85601f16664SJim Ingham TargetSP target_sp = m_target_wp.lock(); 8576ac84034SPavel Labath if (!target_sp || !bkpt) 85801f16664SJim Ingham return false; 8596ac84034SPavel Labath if (bkpt->GetTargetSP() != target_sp) 86001f16664SJim Ingham return false; 8616ac84034SPavel Labath lldb::break_id_t bp_id = bkpt->GetID(); 86201f16664SJim Ingham if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) == 86301f16664SJim Ingham m_break_ids.end()) 86401f16664SJim Ingham return false; 86501f16664SJim Ingham 8666ac84034SPavel Labath m_break_ids.push_back(bkpt->GetID()); 86701f16664SJim Ingham return true; 86801f16664SJim Ingham } 86901f16664SJim Ingham 87001f16664SJim Ingham bool AppendByID(lldb::break_id_t id) { 87101f16664SJim Ingham TargetSP target_sp = m_target_wp.lock(); 87201f16664SJim Ingham if (!target_sp) 87301f16664SJim Ingham return false; 87401f16664SJim Ingham if (id == LLDB_INVALID_BREAK_ID) 87501f16664SJim Ingham return false; 87601f16664SJim Ingham m_break_ids.push_back(id); 87701f16664SJim Ingham return true; 87801f16664SJim Ingham } 87901f16664SJim Ingham 88001f16664SJim Ingham void Clear() { m_break_ids.clear(); } 88101f16664SJim Ingham 88201f16664SJim Ingham void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_list) { 88301f16664SJim Ingham for (lldb::break_id_t id : m_break_ids) { 88401f16664SJim Ingham bp_list.AddBreakpointID(BreakpointID(id)); 88501f16664SJim Ingham } 88601f16664SJim Ingham } 88701f16664SJim Ingham 88801f16664SJim Ingham TargetSP GetTarget() { return m_target_wp.lock(); } 88901f16664SJim Ingham 89001f16664SJim Ingham private: 89101f16664SJim Ingham std::vector<lldb::break_id_t> m_break_ids; 89201f16664SJim Ingham TargetWP m_target_wp; 89301f16664SJim Ingham }; 89401f16664SJim Ingham 89501f16664SJim Ingham SBBreakpointList::SBBreakpointList(SBTarget &target) 896baf5664fSJonas Devlieghere : m_opaque_sp(new SBBreakpointListImpl(target.GetSP())) { 897baf5664fSJonas Devlieghere LLDB_RECORD_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &), target); 898baf5664fSJonas Devlieghere } 89901f16664SJim Ingham 900866b7a65SJonas Devlieghere SBBreakpointList::~SBBreakpointList() = default; 90101f16664SJim Ingham 90201f16664SJim Ingham size_t SBBreakpointList::GetSize() const { 903baf5664fSJonas Devlieghere LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpointList, GetSize); 904baf5664fSJonas Devlieghere 90501f16664SJim Ingham if (!m_opaque_sp) 90601f16664SJim Ingham return 0; 90701f16664SJim Ingham else 90801f16664SJim Ingham return m_opaque_sp->GetSize(); 90901f16664SJim Ingham } 91001f16664SJim Ingham 91101f16664SJim Ingham SBBreakpoint SBBreakpointList::GetBreakpointAtIndex(size_t idx) { 912baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, GetBreakpointAtIndex, 913baf5664fSJonas Devlieghere (size_t), idx); 914baf5664fSJonas Devlieghere 91501f16664SJim Ingham if (!m_opaque_sp) 916baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT(SBBreakpoint()); 91701f16664SJim Ingham 91801f16664SJim Ingham BreakpointSP bkpt_sp = m_opaque_sp->GetBreakpointAtIndex(idx); 919baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp)); 92001f16664SJim Ingham } 92101f16664SJim Ingham 9226d1e4696SJim Ingham SBBreakpoint SBBreakpointList::FindBreakpointByID(lldb::break_id_t id) { 923baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, FindBreakpointByID, 924baf5664fSJonas Devlieghere (lldb::break_id_t), id); 925baf5664fSJonas Devlieghere 9266d1e4696SJim Ingham if (!m_opaque_sp) 927baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT(SBBreakpoint()); 9286d1e4696SJim Ingham BreakpointSP bkpt_sp = m_opaque_sp->FindBreakpointByID(id); 929baf5664fSJonas Devlieghere return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp)); 9306d1e4696SJim Ingham } 9316d1e4696SJim Ingham 93201f16664SJim Ingham void SBBreakpointList::Append(const SBBreakpoint &sb_bkpt) { 933baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(void, SBBreakpointList, Append, 934baf5664fSJonas Devlieghere (const lldb::SBBreakpoint &), sb_bkpt); 935baf5664fSJonas Devlieghere 93601f16664SJim Ingham if (!sb_bkpt.IsValid()) 93701f16664SJim Ingham return; 93801f16664SJim Ingham if (!m_opaque_sp) 93901f16664SJim Ingham return; 9406ac84034SPavel Labath m_opaque_sp->Append(sb_bkpt.m_opaque_wp.lock()); 94101f16664SJim Ingham } 94201f16664SJim Ingham 94301f16664SJim Ingham void SBBreakpointList::AppendByID(lldb::break_id_t id) { 944baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(void, SBBreakpointList, AppendByID, (lldb::break_id_t), 945baf5664fSJonas Devlieghere id); 946baf5664fSJonas Devlieghere 94701f16664SJim Ingham if (!m_opaque_sp) 94801f16664SJim Ingham return; 94901f16664SJim Ingham m_opaque_sp->AppendByID(id); 95001f16664SJim Ingham } 95101f16664SJim Ingham 95201f16664SJim Ingham bool SBBreakpointList::AppendIfUnique(const SBBreakpoint &sb_bkpt) { 953baf5664fSJonas Devlieghere LLDB_RECORD_METHOD(bool, SBBreakpointList, AppendIfUnique, 954baf5664fSJonas Devlieghere (const lldb::SBBreakpoint &), sb_bkpt); 955baf5664fSJonas Devlieghere 95601f16664SJim Ingham if (!sb_bkpt.IsValid()) 95701f16664SJim Ingham return false; 95801f16664SJim Ingham if (!m_opaque_sp) 95901f16664SJim Ingham return false; 9606ac84034SPavel Labath return m_opaque_sp->AppendIfUnique(sb_bkpt.GetSP()); 96101f16664SJim Ingham } 96201f16664SJim Ingham 96301f16664SJim Ingham void SBBreakpointList::Clear() { 964baf5664fSJonas Devlieghere LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpointList, Clear); 965baf5664fSJonas Devlieghere 96601f16664SJim Ingham if (m_opaque_sp) 96701f16664SJim Ingham m_opaque_sp->Clear(); 96801f16664SJim Ingham } 96901f16664SJim Ingham 97001f16664SJim Ingham void SBBreakpointList::CopyToBreakpointIDList( 97101f16664SJim Ingham lldb_private::BreakpointIDList &bp_id_list) { 97201f16664SJim Ingham if (m_opaque_sp) 97301f16664SJim Ingham m_opaque_sp->CopyToBreakpointIDList(bp_id_list); 97401f16664SJim Ingham } 975ae211eceSMichal Gorny 976ae211eceSMichal Gorny namespace lldb_private { 977ae211eceSMichal Gorny namespace repro { 978ae211eceSMichal Gorny 979ae211eceSMichal Gorny template <> 980ae211eceSMichal Gorny void RegisterMethods<SBBreakpoint>(Registry &R) { 981ae211eceSMichal Gorny LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, ()); 982ae211eceSMichal Gorny LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &)); 983ae211eceSMichal Gorny LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &)); 984ae211eceSMichal Gorny LLDB_REGISTER_METHOD(const lldb::SBBreakpoint &, 985ae211eceSMichal Gorny SBBreakpoint, operator=,(const lldb::SBBreakpoint &)); 986ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, 987ae211eceSMichal Gorny SBBreakpoint, operator==,(const lldb::SBBreakpoint &)); 988ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, 989ae211eceSMichal Gorny SBBreakpoint, operator!=,(const lldb::SBBreakpoint &)); 990ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(lldb::break_id_t, SBBreakpoint, GetID, ()); 991ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsValid, ()); 992ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, operator bool, ()); 993ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, ClearAllBreakpointSites, ()); 994ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 995ae211eceSMichal Gorny FindLocationByAddress, (lldb::addr_t)); 996ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::break_id_t, SBBreakpoint, 997ae211eceSMichal Gorny FindLocationIDByAddress, (lldb::addr_t)); 998ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 999ae211eceSMichal Gorny FindLocationByID, (lldb::break_id_t)); 1000ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 1001ae211eceSMichal Gorny GetLocationAtIndex, (uint32_t)); 1002ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetEnabled, (bool)); 1003ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsEnabled, ()); 1004ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetOneShot, (bool)); 1005ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsOneShot, ()); 1006ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsInternal, ()); 1007ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t)); 1008ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCondition, (const char *)); 1009ae211eceSMichal Gorny LLDB_REGISTER_METHOD(const char *, SBBreakpoint, GetCondition, ()); 1010ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetAutoContinue, (bool)); 1011ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetAutoContinue, ()); 1012ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetHitCount, ()); 1013ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetIgnoreCount, ()); 1014ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t)); 1015ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::tid_t, SBBreakpoint, GetThreadID, ()); 1016ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t)); 1017ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetThreadIndex, ()); 1018ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadName, (const char *)); 1019ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetThreadName, ()); 1020ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetQueueName, (const char *)); 1021ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetQueueName, ()); 1022ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumResolvedLocations, 1023ae211eceSMichal Gorny ()); 1024ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumLocations, ()); 1025ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCommandLineCommands, 1026ae211eceSMichal Gorny (lldb::SBStringList &)); 1027ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetCommandLineCommands, 1028ae211eceSMichal Gorny (lldb::SBStringList &)); 1029ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription, 1030ae211eceSMichal Gorny (lldb::SBStream &)); 1031ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription, 1032ae211eceSMichal Gorny (lldb::SBStream &, bool)); 1033ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddLocation, 1034ae211eceSMichal Gorny (lldb::SBAddress &)); 1035*4da8fa45SMed Ismail Bennani LLDB_REGISTER_METHOD(lldb::SBStructuredData, SBBreakpoint, 1036*4da8fa45SMed Ismail Bennani SerializeToStructuredData, ()); 1037ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, SetScriptCallbackFunction, 1038ae211eceSMichal Gorny (const char *)); 1039738af7a6SJim Ingham LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackFunction, 1040738af7a6SJim Ingham (const char *, SBStructuredData &)); 1041ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody, 1042ae211eceSMichal Gorny (const char *)); 1043ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, AddName, (const char *)); 1044f70cad26SMed Ismail Bennani LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddNameWithErrorHandling, 1045f70cad26SMed Ismail Bennani (const char *)); 1046ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, RemoveName, (const char *)); 1047ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpoint, MatchesName, (const char *)); 1048ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &)); 1049ae211eceSMichal Gorny LLDB_REGISTER_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent, 1050ae211eceSMichal Gorny (const lldb::SBEvent &)); 1051ae211eceSMichal Gorny LLDB_REGISTER_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint, 1052ae211eceSMichal Gorny GetBreakpointEventTypeFromEvent, 1053ae211eceSMichal Gorny (const lldb::SBEvent &)); 1054ae211eceSMichal Gorny LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint, 1055ae211eceSMichal Gorny GetBreakpointFromEvent, 1056ae211eceSMichal Gorny (const lldb::SBEvent &)); 1057ae211eceSMichal Gorny LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 1058ae211eceSMichal Gorny GetBreakpointLocationAtIndexFromEvent, 1059ae211eceSMichal Gorny (const lldb::SBEvent &, uint32_t)); 1060ae211eceSMichal Gorny LLDB_REGISTER_STATIC_METHOD(uint32_t, SBBreakpoint, 1061ae211eceSMichal Gorny GetNumBreakpointLocationsFromEvent, 1062ae211eceSMichal Gorny (const lldb::SBEvent &)); 1063ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsHardware, ()); 1064ae211eceSMichal Gorny } 1065ae211eceSMichal Gorny 1066ae211eceSMichal Gorny template <> 1067ae211eceSMichal Gorny void RegisterMethods<SBBreakpointList>(Registry &R) { 1068ae211eceSMichal Gorny LLDB_REGISTER_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &)); 1069ae211eceSMichal Gorny LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpointList, GetSize, ()); 1070ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList, 1071ae211eceSMichal Gorny GetBreakpointAtIndex, (size_t)); 1072ae211eceSMichal Gorny LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList, 1073ae211eceSMichal Gorny FindBreakpointByID, (lldb::break_id_t)); 1074ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpointList, Append, 1075ae211eceSMichal Gorny (const lldb::SBBreakpoint &)); 1076ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpointList, AppendByID, 1077ae211eceSMichal Gorny (lldb::break_id_t)); 1078ae211eceSMichal Gorny LLDB_REGISTER_METHOD(bool, SBBreakpointList, AppendIfUnique, 1079ae211eceSMichal Gorny (const lldb::SBBreakpoint &)); 1080ae211eceSMichal Gorny LLDB_REGISTER_METHOD(void, SBBreakpointList, Clear, ()); 1081ae211eceSMichal Gorny } 1082ae211eceSMichal Gorny 1083ae211eceSMichal Gorny } 1084ae211eceSMichal Gorny } 1085