15ffd83dbSDimitry Andric //===-- SBBreakpoint.cpp --------------------------------------------------===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric 9*0b57cec5SDimitry Andric #include "lldb/API/SBBreakpoint.h" 10*0b57cec5SDimitry Andric #include "SBReproducerPrivate.h" 11*0b57cec5SDimitry Andric #include "lldb/API/SBBreakpointLocation.h" 12*0b57cec5SDimitry Andric #include "lldb/API/SBDebugger.h" 13*0b57cec5SDimitry Andric #include "lldb/API/SBEvent.h" 14*0b57cec5SDimitry Andric #include "lldb/API/SBProcess.h" 15*0b57cec5SDimitry Andric #include "lldb/API/SBStream.h" 16*0b57cec5SDimitry Andric #include "lldb/API/SBStringList.h" 17480093f4SDimitry Andric #include "lldb/API/SBStructuredData.h" 18*0b57cec5SDimitry Andric #include "lldb/API/SBThread.h" 19*0b57cec5SDimitry Andric 20*0b57cec5SDimitry Andric #include "lldb/Breakpoint/Breakpoint.h" 21*0b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointIDList.h" 22*0b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointLocation.h" 23*0b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointResolver.h" 24*0b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointResolverScripted.h" 25*0b57cec5SDimitry Andric #include "lldb/Breakpoint/StoppointCallbackContext.h" 26*0b57cec5SDimitry Andric #include "lldb/Core/Address.h" 27*0b57cec5SDimitry Andric #include "lldb/Core/Debugger.h" 28*0b57cec5SDimitry Andric #include "lldb/Core/StreamFile.h" 29480093f4SDimitry Andric #include "lldb/Core/StructuredDataImpl.h" 30*0b57cec5SDimitry Andric #include "lldb/Interpreter/CommandInterpreter.h" 31*0b57cec5SDimitry Andric #include "lldb/Interpreter/ScriptInterpreter.h" 32*0b57cec5SDimitry Andric #include "lldb/Target/Process.h" 33*0b57cec5SDimitry Andric #include "lldb/Target/SectionLoadList.h" 34*0b57cec5SDimitry Andric #include "lldb/Target/Target.h" 35*0b57cec5SDimitry Andric #include "lldb/Target/Thread.h" 36*0b57cec5SDimitry Andric #include "lldb/Target/ThreadSpec.h" 37*0b57cec5SDimitry Andric #include "lldb/Utility/Stream.h" 38*0b57cec5SDimitry Andric 39*0b57cec5SDimitry Andric #include "SBBreakpointOptionCommon.h" 40*0b57cec5SDimitry Andric 41*0b57cec5SDimitry Andric #include "lldb/lldb-enumerations.h" 42*0b57cec5SDimitry Andric 43*0b57cec5SDimitry Andric #include "llvm/ADT/STLExtras.h" 44*0b57cec5SDimitry Andric 45*0b57cec5SDimitry Andric using namespace lldb; 46*0b57cec5SDimitry Andric using namespace lldb_private; 47*0b57cec5SDimitry Andric 48*0b57cec5SDimitry Andric SBBreakpoint::SBBreakpoint() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBreakpoint); } 49*0b57cec5SDimitry Andric 50*0b57cec5SDimitry Andric SBBreakpoint::SBBreakpoint(const SBBreakpoint &rhs) 51*0b57cec5SDimitry Andric : m_opaque_wp(rhs.m_opaque_wp) { 52*0b57cec5SDimitry Andric LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &), rhs); 53*0b57cec5SDimitry Andric } 54*0b57cec5SDimitry Andric 55*0b57cec5SDimitry Andric SBBreakpoint::SBBreakpoint(const lldb::BreakpointSP &bp_sp) 56*0b57cec5SDimitry Andric : m_opaque_wp(bp_sp) { 57*0b57cec5SDimitry Andric LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &), bp_sp); 58*0b57cec5SDimitry Andric } 59*0b57cec5SDimitry Andric 60*0b57cec5SDimitry Andric SBBreakpoint::~SBBreakpoint() = default; 61*0b57cec5SDimitry Andric 62*0b57cec5SDimitry Andric const SBBreakpoint &SBBreakpoint::operator=(const SBBreakpoint &rhs) { 63*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(const lldb::SBBreakpoint &, 64*0b57cec5SDimitry Andric SBBreakpoint, operator=,(const lldb::SBBreakpoint &), rhs); 65*0b57cec5SDimitry Andric 66*0b57cec5SDimitry Andric m_opaque_wp = rhs.m_opaque_wp; 67*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(*this); 68*0b57cec5SDimitry Andric } 69*0b57cec5SDimitry Andric 70*0b57cec5SDimitry Andric bool SBBreakpoint::operator==(const lldb::SBBreakpoint &rhs) { 71*0b57cec5SDimitry Andric LLDB_RECORD_METHOD( 72*0b57cec5SDimitry Andric bool, SBBreakpoint, operator==,(const lldb::SBBreakpoint &), rhs); 73*0b57cec5SDimitry Andric 74*0b57cec5SDimitry Andric return m_opaque_wp.lock() == rhs.m_opaque_wp.lock(); 75*0b57cec5SDimitry Andric } 76*0b57cec5SDimitry Andric 77*0b57cec5SDimitry Andric bool SBBreakpoint::operator!=(const lldb::SBBreakpoint &rhs) { 78*0b57cec5SDimitry Andric LLDB_RECORD_METHOD( 79*0b57cec5SDimitry Andric bool, SBBreakpoint, operator!=,(const lldb::SBBreakpoint &), rhs); 80*0b57cec5SDimitry Andric 81*0b57cec5SDimitry Andric return m_opaque_wp.lock() != rhs.m_opaque_wp.lock(); 82*0b57cec5SDimitry Andric } 83*0b57cec5SDimitry Andric 84*0b57cec5SDimitry Andric break_id_t SBBreakpoint::GetID() const { 85*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::break_id_t, SBBreakpoint, GetID); 86*0b57cec5SDimitry Andric 87*0b57cec5SDimitry Andric break_id_t break_id = LLDB_INVALID_BREAK_ID; 88*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 89*0b57cec5SDimitry Andric if (bkpt_sp) 90*0b57cec5SDimitry Andric break_id = bkpt_sp->GetID(); 91*0b57cec5SDimitry Andric 92*0b57cec5SDimitry Andric return break_id; 93*0b57cec5SDimitry Andric } 94*0b57cec5SDimitry Andric 95*0b57cec5SDimitry Andric bool SBBreakpoint::IsValid() const { 96*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsValid); 97*0b57cec5SDimitry Andric return this->operator bool(); 98*0b57cec5SDimitry Andric } 99*0b57cec5SDimitry Andric SBBreakpoint::operator bool() const { 100*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, operator bool); 101*0b57cec5SDimitry Andric 102*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 103*0b57cec5SDimitry Andric if (!bkpt_sp) 104*0b57cec5SDimitry Andric return false; 105*0b57cec5SDimitry Andric else if (bkpt_sp->GetTarget().GetBreakpointByID(bkpt_sp->GetID())) 106*0b57cec5SDimitry Andric return true; 107*0b57cec5SDimitry Andric else 108*0b57cec5SDimitry Andric return false; 109*0b57cec5SDimitry Andric } 110*0b57cec5SDimitry Andric 111*0b57cec5SDimitry Andric void SBBreakpoint::ClearAllBreakpointSites() { 112*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpoint, ClearAllBreakpointSites); 113*0b57cec5SDimitry Andric 114*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 115*0b57cec5SDimitry Andric if (bkpt_sp) { 116*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 117*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 118*0b57cec5SDimitry Andric bkpt_sp->ClearAllBreakpointSites(); 119*0b57cec5SDimitry Andric } 120*0b57cec5SDimitry Andric } 121*0b57cec5SDimitry Andric 122*0b57cec5SDimitry Andric SBBreakpointLocation SBBreakpoint::FindLocationByAddress(addr_t vm_addr) { 123*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 124*0b57cec5SDimitry Andric FindLocationByAddress, (lldb::addr_t), vm_addr); 125*0b57cec5SDimitry Andric 126*0b57cec5SDimitry Andric SBBreakpointLocation sb_bp_location; 127*0b57cec5SDimitry Andric 128*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 129*0b57cec5SDimitry Andric if (bkpt_sp) { 130*0b57cec5SDimitry Andric if (vm_addr != LLDB_INVALID_ADDRESS) { 131*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 132*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 133*0b57cec5SDimitry Andric Address address; 134*0b57cec5SDimitry Andric Target &target = bkpt_sp->GetTarget(); 135*0b57cec5SDimitry Andric if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) { 136*0b57cec5SDimitry Andric address.SetRawAddress(vm_addr); 137*0b57cec5SDimitry Andric } 138*0b57cec5SDimitry Andric sb_bp_location.SetLocation(bkpt_sp->FindLocationByAddress(address)); 139*0b57cec5SDimitry Andric } 140*0b57cec5SDimitry Andric } 141*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_bp_location); 142*0b57cec5SDimitry Andric } 143*0b57cec5SDimitry Andric 144*0b57cec5SDimitry Andric break_id_t SBBreakpoint::FindLocationIDByAddress(addr_t vm_addr) { 145*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::break_id_t, SBBreakpoint, FindLocationIDByAddress, 146*0b57cec5SDimitry Andric (lldb::addr_t), vm_addr); 147*0b57cec5SDimitry Andric 148*0b57cec5SDimitry Andric break_id_t break_id = LLDB_INVALID_BREAK_ID; 149*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 150*0b57cec5SDimitry Andric 151*0b57cec5SDimitry Andric if (bkpt_sp && vm_addr != LLDB_INVALID_ADDRESS) { 152*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 153*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 154*0b57cec5SDimitry Andric Address address; 155*0b57cec5SDimitry Andric Target &target = bkpt_sp->GetTarget(); 156*0b57cec5SDimitry Andric if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) { 157*0b57cec5SDimitry Andric address.SetRawAddress(vm_addr); 158*0b57cec5SDimitry Andric } 159*0b57cec5SDimitry Andric break_id = bkpt_sp->FindLocationIDByAddress(address); 160*0b57cec5SDimitry Andric } 161*0b57cec5SDimitry Andric 162*0b57cec5SDimitry Andric return break_id; 163*0b57cec5SDimitry Andric } 164*0b57cec5SDimitry Andric 165*0b57cec5SDimitry Andric SBBreakpointLocation SBBreakpoint::FindLocationByID(break_id_t bp_loc_id) { 166*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, FindLocationByID, 167*0b57cec5SDimitry Andric (lldb::break_id_t), bp_loc_id); 168*0b57cec5SDimitry Andric 169*0b57cec5SDimitry Andric SBBreakpointLocation sb_bp_location; 170*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 171*0b57cec5SDimitry Andric 172*0b57cec5SDimitry Andric if (bkpt_sp) { 173*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 174*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 175*0b57cec5SDimitry Andric sb_bp_location.SetLocation(bkpt_sp->FindLocationByID(bp_loc_id)); 176*0b57cec5SDimitry Andric } 177*0b57cec5SDimitry Andric 178*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_bp_location); 179*0b57cec5SDimitry Andric } 180*0b57cec5SDimitry Andric 181*0b57cec5SDimitry Andric SBBreakpointLocation SBBreakpoint::GetLocationAtIndex(uint32_t index) { 182*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 183*0b57cec5SDimitry Andric GetLocationAtIndex, (uint32_t), index); 184*0b57cec5SDimitry Andric 185*0b57cec5SDimitry Andric SBBreakpointLocation sb_bp_location; 186*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 187*0b57cec5SDimitry Andric 188*0b57cec5SDimitry Andric if (bkpt_sp) { 189*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 190*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 191*0b57cec5SDimitry Andric sb_bp_location.SetLocation(bkpt_sp->GetLocationAtIndex(index)); 192*0b57cec5SDimitry Andric } 193*0b57cec5SDimitry Andric 194*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_bp_location); 195*0b57cec5SDimitry Andric } 196*0b57cec5SDimitry Andric 197*0b57cec5SDimitry Andric void SBBreakpoint::SetEnabled(bool enable) { 198*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetEnabled, (bool), enable); 199*0b57cec5SDimitry Andric 200*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 201*0b57cec5SDimitry Andric 202*0b57cec5SDimitry Andric if (bkpt_sp) { 203*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 204*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 205*0b57cec5SDimitry Andric bkpt_sp->SetEnabled(enable); 206*0b57cec5SDimitry Andric } 207*0b57cec5SDimitry Andric } 208*0b57cec5SDimitry Andric 209*0b57cec5SDimitry Andric bool SBBreakpoint::IsEnabled() { 210*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsEnabled); 211*0b57cec5SDimitry Andric 212*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 213*0b57cec5SDimitry Andric if (bkpt_sp) { 214*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 215*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 216*0b57cec5SDimitry Andric return bkpt_sp->IsEnabled(); 217*0b57cec5SDimitry Andric } else 218*0b57cec5SDimitry Andric return false; 219*0b57cec5SDimitry Andric } 220*0b57cec5SDimitry Andric 221*0b57cec5SDimitry Andric void SBBreakpoint::SetOneShot(bool one_shot) { 222*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetOneShot, (bool), one_shot); 223*0b57cec5SDimitry Andric 224*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 225*0b57cec5SDimitry Andric 226*0b57cec5SDimitry Andric if (bkpt_sp) { 227*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 228*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 229*0b57cec5SDimitry Andric bkpt_sp->SetOneShot(one_shot); 230*0b57cec5SDimitry Andric } 231*0b57cec5SDimitry Andric } 232*0b57cec5SDimitry Andric 233*0b57cec5SDimitry Andric bool SBBreakpoint::IsOneShot() const { 234*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsOneShot); 235*0b57cec5SDimitry Andric 236*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 237*0b57cec5SDimitry Andric if (bkpt_sp) { 238*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 239*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 240*0b57cec5SDimitry Andric return bkpt_sp->IsOneShot(); 241*0b57cec5SDimitry Andric } else 242*0b57cec5SDimitry Andric return false; 243*0b57cec5SDimitry Andric } 244*0b57cec5SDimitry Andric 245*0b57cec5SDimitry Andric bool SBBreakpoint::IsInternal() { 246*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsInternal); 247*0b57cec5SDimitry Andric 248*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 249*0b57cec5SDimitry Andric if (bkpt_sp) { 250*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 251*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 252*0b57cec5SDimitry Andric return bkpt_sp->IsInternal(); 253*0b57cec5SDimitry Andric } else 254*0b57cec5SDimitry Andric return false; 255*0b57cec5SDimitry Andric } 256*0b57cec5SDimitry Andric 257*0b57cec5SDimitry Andric void SBBreakpoint::SetIgnoreCount(uint32_t count) { 258*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t), count); 259*0b57cec5SDimitry Andric 260*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 261*0b57cec5SDimitry Andric 262*0b57cec5SDimitry Andric if (bkpt_sp) { 263*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 264*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 265*0b57cec5SDimitry Andric bkpt_sp->SetIgnoreCount(count); 266*0b57cec5SDimitry Andric } 267*0b57cec5SDimitry Andric } 268*0b57cec5SDimitry Andric 269*0b57cec5SDimitry Andric void SBBreakpoint::SetCondition(const char *condition) { 270*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetCondition, (const char *), 271*0b57cec5SDimitry Andric condition); 272*0b57cec5SDimitry Andric 273*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 274*0b57cec5SDimitry Andric if (bkpt_sp) { 275*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 276*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 277*0b57cec5SDimitry Andric bkpt_sp->SetCondition(condition); 278*0b57cec5SDimitry Andric } 279*0b57cec5SDimitry Andric } 280*0b57cec5SDimitry Andric 281*0b57cec5SDimitry Andric const char *SBBreakpoint::GetCondition() { 282*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(const char *, SBBreakpoint, GetCondition); 283*0b57cec5SDimitry Andric 284*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 285*0b57cec5SDimitry Andric if (bkpt_sp) { 286*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 287*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 288*0b57cec5SDimitry Andric return bkpt_sp->GetConditionText(); 289*0b57cec5SDimitry Andric } 290*0b57cec5SDimitry Andric return nullptr; 291*0b57cec5SDimitry Andric } 292*0b57cec5SDimitry Andric 293*0b57cec5SDimitry Andric void SBBreakpoint::SetAutoContinue(bool auto_continue) { 294*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetAutoContinue, (bool), 295*0b57cec5SDimitry Andric auto_continue); 296*0b57cec5SDimitry Andric 297*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 298*0b57cec5SDimitry Andric if (bkpt_sp) { 299*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 300*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 301*0b57cec5SDimitry Andric bkpt_sp->SetAutoContinue(auto_continue); 302*0b57cec5SDimitry Andric } 303*0b57cec5SDimitry Andric } 304*0b57cec5SDimitry Andric 305*0b57cec5SDimitry Andric bool SBBreakpoint::GetAutoContinue() { 306*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, GetAutoContinue); 307*0b57cec5SDimitry Andric 308*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 309*0b57cec5SDimitry Andric if (bkpt_sp) { 310*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 311*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 312*0b57cec5SDimitry Andric return bkpt_sp->IsAutoContinue(); 313*0b57cec5SDimitry Andric } 314*0b57cec5SDimitry Andric return false; 315*0b57cec5SDimitry Andric } 316*0b57cec5SDimitry Andric 317*0b57cec5SDimitry Andric uint32_t SBBreakpoint::GetHitCount() const { 318*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetHitCount); 319*0b57cec5SDimitry Andric 320*0b57cec5SDimitry Andric uint32_t count = 0; 321*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 322*0b57cec5SDimitry Andric if (bkpt_sp) { 323*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 324*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 325*0b57cec5SDimitry Andric count = bkpt_sp->GetHitCount(); 326*0b57cec5SDimitry Andric } 327*0b57cec5SDimitry Andric 328*0b57cec5SDimitry Andric return count; 329*0b57cec5SDimitry Andric } 330*0b57cec5SDimitry Andric 331*0b57cec5SDimitry Andric uint32_t SBBreakpoint::GetIgnoreCount() const { 332*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetIgnoreCount); 333*0b57cec5SDimitry Andric 334*0b57cec5SDimitry Andric uint32_t count = 0; 335*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 336*0b57cec5SDimitry Andric if (bkpt_sp) { 337*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 338*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 339*0b57cec5SDimitry Andric count = bkpt_sp->GetIgnoreCount(); 340*0b57cec5SDimitry Andric } 341*0b57cec5SDimitry Andric 342*0b57cec5SDimitry Andric return count; 343*0b57cec5SDimitry Andric } 344*0b57cec5SDimitry Andric 345*0b57cec5SDimitry Andric void SBBreakpoint::SetThreadID(tid_t tid) { 346*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t), tid); 347*0b57cec5SDimitry Andric 348*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 349*0b57cec5SDimitry Andric if (bkpt_sp) { 350*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 351*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 352*0b57cec5SDimitry Andric bkpt_sp->SetThreadID(tid); 353*0b57cec5SDimitry Andric } 354*0b57cec5SDimitry Andric } 355*0b57cec5SDimitry Andric 356*0b57cec5SDimitry Andric tid_t SBBreakpoint::GetThreadID() { 357*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(lldb::tid_t, SBBreakpoint, GetThreadID); 358*0b57cec5SDimitry Andric 359*0b57cec5SDimitry Andric tid_t tid = LLDB_INVALID_THREAD_ID; 360*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 361*0b57cec5SDimitry Andric if (bkpt_sp) { 362*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 363*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 364*0b57cec5SDimitry Andric tid = bkpt_sp->GetThreadID(); 365*0b57cec5SDimitry Andric } 366*0b57cec5SDimitry Andric 367*0b57cec5SDimitry Andric return tid; 368*0b57cec5SDimitry Andric } 369*0b57cec5SDimitry Andric 370*0b57cec5SDimitry Andric void SBBreakpoint::SetThreadIndex(uint32_t index) { 371*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t), index); 372*0b57cec5SDimitry Andric 373*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 374*0b57cec5SDimitry Andric if (bkpt_sp) { 375*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 376*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 377*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->GetThreadSpec()->SetIndex(index); 378*0b57cec5SDimitry Andric } 379*0b57cec5SDimitry Andric } 380*0b57cec5SDimitry Andric 381*0b57cec5SDimitry Andric uint32_t SBBreakpoint::GetThreadIndex() const { 382*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetThreadIndex); 383*0b57cec5SDimitry Andric 384*0b57cec5SDimitry Andric uint32_t thread_idx = UINT32_MAX; 385*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 386*0b57cec5SDimitry Andric if (bkpt_sp) { 387*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 388*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 389*0b57cec5SDimitry Andric const ThreadSpec *thread_spec = 390*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->GetThreadSpecNoCreate(); 391*0b57cec5SDimitry Andric if (thread_spec != nullptr) 392*0b57cec5SDimitry Andric thread_idx = thread_spec->GetIndex(); 393*0b57cec5SDimitry Andric } 394*0b57cec5SDimitry Andric 395*0b57cec5SDimitry Andric return thread_idx; 396*0b57cec5SDimitry Andric } 397*0b57cec5SDimitry Andric 398*0b57cec5SDimitry Andric void SBBreakpoint::SetThreadName(const char *thread_name) { 399*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadName, (const char *), 400*0b57cec5SDimitry Andric thread_name); 401*0b57cec5SDimitry Andric 402*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 403*0b57cec5SDimitry Andric 404*0b57cec5SDimitry Andric if (bkpt_sp) { 405*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 406*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 407*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->GetThreadSpec()->SetName(thread_name); 408*0b57cec5SDimitry Andric } 409*0b57cec5SDimitry Andric } 410*0b57cec5SDimitry Andric 411*0b57cec5SDimitry Andric const char *SBBreakpoint::GetThreadName() const { 412*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetThreadName); 413*0b57cec5SDimitry Andric 414*0b57cec5SDimitry Andric const char *name = nullptr; 415*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 416*0b57cec5SDimitry Andric if (bkpt_sp) { 417*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 418*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 419*0b57cec5SDimitry Andric const ThreadSpec *thread_spec = 420*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->GetThreadSpecNoCreate(); 421*0b57cec5SDimitry Andric if (thread_spec != nullptr) 422*0b57cec5SDimitry Andric name = thread_spec->GetName(); 423*0b57cec5SDimitry Andric } 424*0b57cec5SDimitry Andric 425*0b57cec5SDimitry Andric return name; 426*0b57cec5SDimitry Andric } 427*0b57cec5SDimitry Andric 428*0b57cec5SDimitry Andric void SBBreakpoint::SetQueueName(const char *queue_name) { 429*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetQueueName, (const char *), 430*0b57cec5SDimitry Andric queue_name); 431*0b57cec5SDimitry Andric 432*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 433*0b57cec5SDimitry Andric if (bkpt_sp) { 434*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 435*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 436*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->GetThreadSpec()->SetQueueName(queue_name); 437*0b57cec5SDimitry Andric } 438*0b57cec5SDimitry Andric } 439*0b57cec5SDimitry Andric 440*0b57cec5SDimitry Andric const char *SBBreakpoint::GetQueueName() const { 441*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetQueueName); 442*0b57cec5SDimitry Andric 443*0b57cec5SDimitry Andric const char *name = nullptr; 444*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 445*0b57cec5SDimitry Andric if (bkpt_sp) { 446*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 447*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 448*0b57cec5SDimitry Andric const ThreadSpec *thread_spec = 449*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->GetThreadSpecNoCreate(); 450*0b57cec5SDimitry Andric if (thread_spec) 451*0b57cec5SDimitry Andric name = thread_spec->GetQueueName(); 452*0b57cec5SDimitry Andric } 453*0b57cec5SDimitry Andric 454*0b57cec5SDimitry Andric return name; 455*0b57cec5SDimitry Andric } 456*0b57cec5SDimitry Andric 457*0b57cec5SDimitry Andric size_t SBBreakpoint::GetNumResolvedLocations() const { 458*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint, 459*0b57cec5SDimitry Andric GetNumResolvedLocations); 460*0b57cec5SDimitry Andric 461*0b57cec5SDimitry Andric size_t num_resolved = 0; 462*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 463*0b57cec5SDimitry Andric if (bkpt_sp) { 464*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 465*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 466*0b57cec5SDimitry Andric num_resolved = bkpt_sp->GetNumResolvedLocations(); 467*0b57cec5SDimitry Andric } 468*0b57cec5SDimitry Andric return num_resolved; 469*0b57cec5SDimitry Andric } 470*0b57cec5SDimitry Andric 471*0b57cec5SDimitry Andric size_t SBBreakpoint::GetNumLocations() const { 472*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint, GetNumLocations); 473*0b57cec5SDimitry Andric 474*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 475*0b57cec5SDimitry Andric size_t num_locs = 0; 476*0b57cec5SDimitry Andric if (bkpt_sp) { 477*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 478*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 479*0b57cec5SDimitry Andric num_locs = bkpt_sp->GetNumLocations(); 480*0b57cec5SDimitry Andric } 481*0b57cec5SDimitry Andric return num_locs; 482*0b57cec5SDimitry Andric } 483*0b57cec5SDimitry Andric 484*0b57cec5SDimitry Andric void SBBreakpoint::SetCommandLineCommands(SBStringList &commands) { 485*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetCommandLineCommands, 486*0b57cec5SDimitry Andric (lldb::SBStringList &), commands); 487*0b57cec5SDimitry Andric 488*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 489*0b57cec5SDimitry Andric if (!bkpt_sp) 490*0b57cec5SDimitry Andric return; 491*0b57cec5SDimitry Andric if (commands.GetSize() == 0) 492*0b57cec5SDimitry Andric return; 493*0b57cec5SDimitry Andric 494*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 495*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 496*0b57cec5SDimitry Andric std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up( 497*0b57cec5SDimitry Andric new BreakpointOptions::CommandData(*commands, eScriptLanguageNone)); 498*0b57cec5SDimitry Andric 499*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->SetCommandDataCallback(cmd_data_up); 500*0b57cec5SDimitry Andric } 501*0b57cec5SDimitry Andric 502*0b57cec5SDimitry Andric bool SBBreakpoint::GetCommandLineCommands(SBStringList &commands) { 503*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, GetCommandLineCommands, 504*0b57cec5SDimitry Andric (lldb::SBStringList &), commands); 505*0b57cec5SDimitry Andric 506*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 507*0b57cec5SDimitry Andric if (!bkpt_sp) 508*0b57cec5SDimitry Andric return false; 509*0b57cec5SDimitry Andric StringList command_list; 510*0b57cec5SDimitry Andric bool has_commands = 511*0b57cec5SDimitry Andric bkpt_sp->GetOptions()->GetCommandLineCallbacks(command_list); 512*0b57cec5SDimitry Andric if (has_commands) 513*0b57cec5SDimitry Andric commands.AppendList(command_list); 514*0b57cec5SDimitry Andric return has_commands; 515*0b57cec5SDimitry Andric } 516*0b57cec5SDimitry Andric 517*0b57cec5SDimitry Andric bool SBBreakpoint::GetDescription(SBStream &s) { 518*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription, (lldb::SBStream &), s); 519*0b57cec5SDimitry Andric 520*0b57cec5SDimitry Andric return GetDescription(s, true); 521*0b57cec5SDimitry Andric } 522*0b57cec5SDimitry Andric 523*0b57cec5SDimitry Andric bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) { 524*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription, 525*0b57cec5SDimitry Andric (lldb::SBStream &, bool), s, include_locations); 526*0b57cec5SDimitry Andric 527*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 528*0b57cec5SDimitry Andric if (bkpt_sp) { 529*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 530*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 531*0b57cec5SDimitry Andric s.Printf("SBBreakpoint: id = %i, ", bkpt_sp->GetID()); 532*0b57cec5SDimitry Andric bkpt_sp->GetResolverDescription(s.get()); 533*0b57cec5SDimitry Andric bkpt_sp->GetFilterDescription(s.get()); 534*0b57cec5SDimitry Andric if (include_locations) { 535*0b57cec5SDimitry Andric const size_t num_locations = bkpt_sp->GetNumLocations(); 536*0b57cec5SDimitry Andric s.Printf(", locations = %" PRIu64, (uint64_t)num_locations); 537*0b57cec5SDimitry Andric } 538*0b57cec5SDimitry Andric return true; 539*0b57cec5SDimitry Andric } 540*0b57cec5SDimitry Andric s.Printf("No value"); 541*0b57cec5SDimitry Andric return false; 542*0b57cec5SDimitry Andric } 543*0b57cec5SDimitry Andric 544*0b57cec5SDimitry Andric SBError SBBreakpoint::AddLocation(SBAddress &address) { 545*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, AddLocation, 546*0b57cec5SDimitry Andric (lldb::SBAddress &), address); 547*0b57cec5SDimitry Andric 548*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 549*0b57cec5SDimitry Andric SBError error; 550*0b57cec5SDimitry Andric 551*0b57cec5SDimitry Andric if (!address.IsValid()) { 552*0b57cec5SDimitry Andric error.SetErrorString("Can't add an invalid address."); 553*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error); 554*0b57cec5SDimitry Andric } 555*0b57cec5SDimitry Andric 556*0b57cec5SDimitry Andric if (!bkpt_sp) { 557*0b57cec5SDimitry Andric error.SetErrorString("No breakpoint to add a location to."); 558*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error); 559*0b57cec5SDimitry Andric } 560*0b57cec5SDimitry Andric 561*0b57cec5SDimitry Andric if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) { 562*0b57cec5SDimitry Andric error.SetErrorString("Only a scripted resolver can add locations."); 563*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error); 564*0b57cec5SDimitry Andric } 565*0b57cec5SDimitry Andric 566*0b57cec5SDimitry Andric if (bkpt_sp->GetSearchFilter()->AddressPasses(address.ref())) 567*0b57cec5SDimitry Andric bkpt_sp->AddLocation(address.ref()); 568*0b57cec5SDimitry Andric else { 569*0b57cec5SDimitry Andric StreamString s; 570*0b57cec5SDimitry Andric address.get()->Dump(&s, &bkpt_sp->GetTarget(), 571*0b57cec5SDimitry Andric Address::DumpStyleModuleWithFileAddress); 572*0b57cec5SDimitry Andric error.SetErrorStringWithFormat("Address: %s didn't pass the filter.", 573*0b57cec5SDimitry Andric s.GetData()); 574*0b57cec5SDimitry Andric } 575*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error); 576*0b57cec5SDimitry Andric } 577*0b57cec5SDimitry Andric 578*0b57cec5SDimitry Andric void SBBreakpoint ::SetCallback(SBBreakpointHitCallback callback, void *baton) { 579*0b57cec5SDimitry Andric LLDB_RECORD_DUMMY(void, SBBreakpoint, SetCallback, 580*0b57cec5SDimitry Andric (lldb::SBBreakpointHitCallback, void *), callback, baton); 581*0b57cec5SDimitry Andric 582*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 583*0b57cec5SDimitry Andric 584*0b57cec5SDimitry Andric if (bkpt_sp) { 585*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 586*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 587*0b57cec5SDimitry Andric BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton)); 588*0b57cec5SDimitry Andric bkpt_sp->SetCallback(SBBreakpointCallbackBaton 589*0b57cec5SDimitry Andric ::PrivateBreakpointHitCallback, baton_sp, 590*0b57cec5SDimitry Andric false); 591*0b57cec5SDimitry Andric } 592*0b57cec5SDimitry Andric } 593*0b57cec5SDimitry Andric 594*0b57cec5SDimitry Andric void SBBreakpoint::SetScriptCallbackFunction( 595*0b57cec5SDimitry Andric const char *callback_function_name) { 596*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetScriptCallbackFunction, 597*0b57cec5SDimitry Andric (const char *), callback_function_name); 598480093f4SDimitry Andric SBStructuredData empty_args; 599480093f4SDimitry Andric SetScriptCallbackFunction(callback_function_name, empty_args); 600480093f4SDimitry Andric } 601*0b57cec5SDimitry Andric 602480093f4SDimitry Andric SBError SBBreakpoint::SetScriptCallbackFunction( 603480093f4SDimitry Andric const char *callback_function_name, 604480093f4SDimitry Andric SBStructuredData &extra_args) { 605480093f4SDimitry Andric LLDB_RECORD_METHOD(SBError, SBBreakpoint, SetScriptCallbackFunction, 606480093f4SDimitry Andric (const char *, SBStructuredData &), callback_function_name, extra_args); 607480093f4SDimitry Andric SBError sb_error; 608*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 609*0b57cec5SDimitry Andric 610*0b57cec5SDimitry Andric if (bkpt_sp) { 611480093f4SDimitry Andric Status error; 612*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 613*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 614*0b57cec5SDimitry Andric BreakpointOptions *bp_options = bkpt_sp->GetOptions(); 615480093f4SDimitry Andric error = bkpt_sp->GetTarget() 616*0b57cec5SDimitry Andric .GetDebugger() 617*0b57cec5SDimitry Andric .GetScriptInterpreter() 618*0b57cec5SDimitry Andric ->SetBreakpointCommandCallbackFunction(bp_options, 619480093f4SDimitry Andric callback_function_name, 620480093f4SDimitry Andric extra_args.m_impl_up 621480093f4SDimitry Andric ->GetObjectSP()); 622480093f4SDimitry Andric sb_error.SetError(error); 623480093f4SDimitry Andric } else 624480093f4SDimitry Andric sb_error.SetErrorString("invalid breakpoint"); 625480093f4SDimitry Andric 626480093f4SDimitry Andric return LLDB_RECORD_RESULT(sb_error); 627*0b57cec5SDimitry Andric } 628*0b57cec5SDimitry Andric 629*0b57cec5SDimitry Andric SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) { 630*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody, 631*0b57cec5SDimitry Andric (const char *), callback_body_text); 632*0b57cec5SDimitry Andric 633*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 634*0b57cec5SDimitry Andric 635*0b57cec5SDimitry Andric SBError sb_error; 636*0b57cec5SDimitry Andric if (bkpt_sp) { 637*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 638*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 639*0b57cec5SDimitry Andric BreakpointOptions *bp_options = bkpt_sp->GetOptions(); 640*0b57cec5SDimitry Andric Status error = 641*0b57cec5SDimitry Andric bkpt_sp->GetTarget() 642*0b57cec5SDimitry Andric .GetDebugger() 643*0b57cec5SDimitry Andric .GetScriptInterpreter() 644*0b57cec5SDimitry Andric ->SetBreakpointCommandCallback(bp_options, callback_body_text); 645*0b57cec5SDimitry Andric sb_error.SetError(error); 646*0b57cec5SDimitry Andric } else 647*0b57cec5SDimitry Andric sb_error.SetErrorString("invalid breakpoint"); 648*0b57cec5SDimitry Andric 649*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_error); 650*0b57cec5SDimitry Andric } 651*0b57cec5SDimitry Andric 652*0b57cec5SDimitry Andric bool SBBreakpoint::AddName(const char *new_name) { 653*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, AddName, (const char *), new_name); 654*0b57cec5SDimitry Andric 6555ffd83dbSDimitry Andric SBError status = AddNameWithErrorHandling(new_name); 6565ffd83dbSDimitry Andric return status.Success(); 6575ffd83dbSDimitry Andric } 6585ffd83dbSDimitry Andric 6595ffd83dbSDimitry Andric SBError SBBreakpoint::AddNameWithErrorHandling(const char *new_name) { 6605ffd83dbSDimitry Andric LLDB_RECORD_METHOD(SBError, SBBreakpoint, AddNameWithErrorHandling, 6615ffd83dbSDimitry Andric (const char *), new_name); 6625ffd83dbSDimitry Andric 663*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 664*0b57cec5SDimitry Andric 6655ffd83dbSDimitry Andric SBError status; 666*0b57cec5SDimitry Andric if (bkpt_sp) { 667*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 668*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 6695ffd83dbSDimitry Andric Status error; 670*0b57cec5SDimitry Andric bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name, error); 6715ffd83dbSDimitry Andric status.SetError(error); 6725ffd83dbSDimitry Andric } else { 6735ffd83dbSDimitry Andric status.SetErrorString("invalid breakpoint"); 674*0b57cec5SDimitry Andric } 675*0b57cec5SDimitry Andric 6765ffd83dbSDimitry Andric return LLDB_RECORD_RESULT(status); 677*0b57cec5SDimitry Andric } 678*0b57cec5SDimitry Andric 679*0b57cec5SDimitry Andric void SBBreakpoint::RemoveName(const char *name_to_remove) { 680*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, RemoveName, (const char *), 681*0b57cec5SDimitry Andric name_to_remove); 682*0b57cec5SDimitry Andric 683*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 684*0b57cec5SDimitry Andric 685*0b57cec5SDimitry Andric if (bkpt_sp) { 686*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 687*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 688*0b57cec5SDimitry Andric bkpt_sp->GetTarget().RemoveNameFromBreakpoint(bkpt_sp, 689*0b57cec5SDimitry Andric ConstString(name_to_remove)); 690*0b57cec5SDimitry Andric } 691*0b57cec5SDimitry Andric } 692*0b57cec5SDimitry Andric 693*0b57cec5SDimitry Andric bool SBBreakpoint::MatchesName(const char *name) { 694*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, MatchesName, (const char *), name); 695*0b57cec5SDimitry Andric 696*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 697*0b57cec5SDimitry Andric 698*0b57cec5SDimitry Andric if (bkpt_sp) { 699*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 700*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 701*0b57cec5SDimitry Andric return bkpt_sp->MatchesName(name); 702*0b57cec5SDimitry Andric } 703*0b57cec5SDimitry Andric 704*0b57cec5SDimitry Andric return false; 705*0b57cec5SDimitry Andric } 706*0b57cec5SDimitry Andric 707*0b57cec5SDimitry Andric void SBBreakpoint::GetNames(SBStringList &names) { 708*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &), 709*0b57cec5SDimitry Andric names); 710*0b57cec5SDimitry Andric 711*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 712*0b57cec5SDimitry Andric 713*0b57cec5SDimitry Andric if (bkpt_sp) { 714*0b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard( 715*0b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex()); 716*0b57cec5SDimitry Andric std::vector<std::string> names_vec; 717*0b57cec5SDimitry Andric bkpt_sp->GetNames(names_vec); 718*0b57cec5SDimitry Andric for (std::string name : names_vec) { 719*0b57cec5SDimitry Andric names.AppendString(name.c_str()); 720*0b57cec5SDimitry Andric } 721*0b57cec5SDimitry Andric } 722*0b57cec5SDimitry Andric } 723*0b57cec5SDimitry Andric 724*0b57cec5SDimitry Andric bool SBBreakpoint::EventIsBreakpointEvent(const lldb::SBEvent &event) { 725*0b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent, 726*0b57cec5SDimitry Andric (const lldb::SBEvent &), event); 727*0b57cec5SDimitry Andric 728*0b57cec5SDimitry Andric return Breakpoint::BreakpointEventData::GetEventDataFromEvent(event.get()) != 729*0b57cec5SDimitry Andric nullptr; 730*0b57cec5SDimitry Andric } 731*0b57cec5SDimitry Andric 732*0b57cec5SDimitry Andric BreakpointEventType 733*0b57cec5SDimitry Andric SBBreakpoint::GetBreakpointEventTypeFromEvent(const SBEvent &event) { 734*0b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint, 735*0b57cec5SDimitry Andric GetBreakpointEventTypeFromEvent, 736*0b57cec5SDimitry Andric (const lldb::SBEvent &), event); 737*0b57cec5SDimitry Andric 738*0b57cec5SDimitry Andric if (event.IsValid()) 739*0b57cec5SDimitry Andric return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent( 740*0b57cec5SDimitry Andric event.GetSP()); 741*0b57cec5SDimitry Andric return eBreakpointEventTypeInvalidType; 742*0b57cec5SDimitry Andric } 743*0b57cec5SDimitry Andric 744*0b57cec5SDimitry Andric SBBreakpoint SBBreakpoint::GetBreakpointFromEvent(const lldb::SBEvent &event) { 745*0b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint, 746*0b57cec5SDimitry Andric GetBreakpointFromEvent, (const lldb::SBEvent &), 747*0b57cec5SDimitry Andric event); 748*0b57cec5SDimitry Andric 749*0b57cec5SDimitry Andric if (event.IsValid()) 750*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT( 751*0b57cec5SDimitry Andric SBBreakpoint(Breakpoint::BreakpointEventData::GetBreakpointFromEvent( 752*0b57cec5SDimitry Andric event.GetSP()))); 753*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint()); 754*0b57cec5SDimitry Andric } 755*0b57cec5SDimitry Andric 756*0b57cec5SDimitry Andric SBBreakpointLocation 757*0b57cec5SDimitry Andric SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event, 758*0b57cec5SDimitry Andric uint32_t loc_idx) { 759*0b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 760*0b57cec5SDimitry Andric GetBreakpointLocationAtIndexFromEvent, 761*0b57cec5SDimitry Andric (const lldb::SBEvent &, uint32_t), event, loc_idx); 762*0b57cec5SDimitry Andric 763*0b57cec5SDimitry Andric SBBreakpointLocation sb_breakpoint_loc; 764*0b57cec5SDimitry Andric if (event.IsValid()) 765*0b57cec5SDimitry Andric sb_breakpoint_loc.SetLocation( 766*0b57cec5SDimitry Andric Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent( 767*0b57cec5SDimitry Andric event.GetSP(), loc_idx)); 768*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_breakpoint_loc); 769*0b57cec5SDimitry Andric } 770*0b57cec5SDimitry Andric 771*0b57cec5SDimitry Andric uint32_t 772*0b57cec5SDimitry Andric SBBreakpoint::GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event) { 773*0b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(uint32_t, SBBreakpoint, 774*0b57cec5SDimitry Andric GetNumBreakpointLocationsFromEvent, 775*0b57cec5SDimitry Andric (const lldb::SBEvent &), event); 776*0b57cec5SDimitry Andric 777*0b57cec5SDimitry Andric uint32_t num_locations = 0; 778*0b57cec5SDimitry Andric if (event.IsValid()) 779*0b57cec5SDimitry Andric num_locations = 780*0b57cec5SDimitry Andric (Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent( 781*0b57cec5SDimitry Andric event.GetSP())); 782*0b57cec5SDimitry Andric return num_locations; 783*0b57cec5SDimitry Andric } 784*0b57cec5SDimitry Andric 785*0b57cec5SDimitry Andric bool SBBreakpoint::IsHardware() const { 786*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsHardware); 787*0b57cec5SDimitry Andric 788*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP(); 789*0b57cec5SDimitry Andric if (bkpt_sp) 790*0b57cec5SDimitry Andric return bkpt_sp->IsHardware(); 791*0b57cec5SDimitry Andric return false; 792*0b57cec5SDimitry Andric } 793*0b57cec5SDimitry Andric 794*0b57cec5SDimitry Andric BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); } 795*0b57cec5SDimitry Andric 796*0b57cec5SDimitry Andric // This is simple collection of breakpoint id's and their target. 797*0b57cec5SDimitry Andric class SBBreakpointListImpl { 798*0b57cec5SDimitry Andric public: 799*0b57cec5SDimitry Andric SBBreakpointListImpl(lldb::TargetSP target_sp) : m_target_wp() { 800*0b57cec5SDimitry Andric if (target_sp && target_sp->IsValid()) 801*0b57cec5SDimitry Andric m_target_wp = target_sp; 802*0b57cec5SDimitry Andric } 803*0b57cec5SDimitry Andric 804*0b57cec5SDimitry Andric ~SBBreakpointListImpl() = default; 805*0b57cec5SDimitry Andric 806*0b57cec5SDimitry Andric size_t GetSize() { return m_break_ids.size(); } 807*0b57cec5SDimitry Andric 808*0b57cec5SDimitry Andric BreakpointSP GetBreakpointAtIndex(size_t idx) { 809*0b57cec5SDimitry Andric if (idx >= m_break_ids.size()) 810*0b57cec5SDimitry Andric return BreakpointSP(); 811*0b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock(); 812*0b57cec5SDimitry Andric if (!target_sp) 813*0b57cec5SDimitry Andric return BreakpointSP(); 814*0b57cec5SDimitry Andric lldb::break_id_t bp_id = m_break_ids[idx]; 815*0b57cec5SDimitry Andric return target_sp->GetBreakpointList().FindBreakpointByID(bp_id); 816*0b57cec5SDimitry Andric } 817*0b57cec5SDimitry Andric 818*0b57cec5SDimitry Andric BreakpointSP FindBreakpointByID(lldb::break_id_t desired_id) { 819*0b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock(); 820*0b57cec5SDimitry Andric if (!target_sp) 821*0b57cec5SDimitry Andric return BreakpointSP(); 822*0b57cec5SDimitry Andric 823*0b57cec5SDimitry Andric for (lldb::break_id_t &break_id : m_break_ids) { 824*0b57cec5SDimitry Andric if (break_id == desired_id) 825*0b57cec5SDimitry Andric return target_sp->GetBreakpointList().FindBreakpointByID(break_id); 826*0b57cec5SDimitry Andric } 827*0b57cec5SDimitry Andric return BreakpointSP(); 828*0b57cec5SDimitry Andric } 829*0b57cec5SDimitry Andric 830*0b57cec5SDimitry Andric bool Append(BreakpointSP bkpt) { 831*0b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock(); 832*0b57cec5SDimitry Andric if (!target_sp || !bkpt) 833*0b57cec5SDimitry Andric return false; 834*0b57cec5SDimitry Andric if (bkpt->GetTargetSP() != target_sp) 835*0b57cec5SDimitry Andric return false; 836*0b57cec5SDimitry Andric m_break_ids.push_back(bkpt->GetID()); 837*0b57cec5SDimitry Andric return true; 838*0b57cec5SDimitry Andric } 839*0b57cec5SDimitry Andric 840*0b57cec5SDimitry Andric bool AppendIfUnique(BreakpointSP bkpt) { 841*0b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock(); 842*0b57cec5SDimitry Andric if (!target_sp || !bkpt) 843*0b57cec5SDimitry Andric return false; 844*0b57cec5SDimitry Andric if (bkpt->GetTargetSP() != target_sp) 845*0b57cec5SDimitry Andric return false; 846*0b57cec5SDimitry Andric lldb::break_id_t bp_id = bkpt->GetID(); 847*0b57cec5SDimitry Andric if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) == 848*0b57cec5SDimitry Andric m_break_ids.end()) 849*0b57cec5SDimitry Andric return false; 850*0b57cec5SDimitry Andric 851*0b57cec5SDimitry Andric m_break_ids.push_back(bkpt->GetID()); 852*0b57cec5SDimitry Andric return true; 853*0b57cec5SDimitry Andric } 854*0b57cec5SDimitry Andric 855*0b57cec5SDimitry Andric bool AppendByID(lldb::break_id_t id) { 856*0b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock(); 857*0b57cec5SDimitry Andric if (!target_sp) 858*0b57cec5SDimitry Andric return false; 859*0b57cec5SDimitry Andric if (id == LLDB_INVALID_BREAK_ID) 860*0b57cec5SDimitry Andric return false; 861*0b57cec5SDimitry Andric m_break_ids.push_back(id); 862*0b57cec5SDimitry Andric return true; 863*0b57cec5SDimitry Andric } 864*0b57cec5SDimitry Andric 865*0b57cec5SDimitry Andric void Clear() { m_break_ids.clear(); } 866*0b57cec5SDimitry Andric 867*0b57cec5SDimitry Andric void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_list) { 868*0b57cec5SDimitry Andric for (lldb::break_id_t id : m_break_ids) { 869*0b57cec5SDimitry Andric bp_list.AddBreakpointID(BreakpointID(id)); 870*0b57cec5SDimitry Andric } 871*0b57cec5SDimitry Andric } 872*0b57cec5SDimitry Andric 873*0b57cec5SDimitry Andric TargetSP GetTarget() { return m_target_wp.lock(); } 874*0b57cec5SDimitry Andric 875*0b57cec5SDimitry Andric private: 876*0b57cec5SDimitry Andric std::vector<lldb::break_id_t> m_break_ids; 877*0b57cec5SDimitry Andric TargetWP m_target_wp; 878*0b57cec5SDimitry Andric }; 879*0b57cec5SDimitry Andric 880*0b57cec5SDimitry Andric SBBreakpointList::SBBreakpointList(SBTarget &target) 881*0b57cec5SDimitry Andric : m_opaque_sp(new SBBreakpointListImpl(target.GetSP())) { 882*0b57cec5SDimitry Andric LLDB_RECORD_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &), target); 883*0b57cec5SDimitry Andric } 884*0b57cec5SDimitry Andric 8855ffd83dbSDimitry Andric SBBreakpointList::~SBBreakpointList() = default; 886*0b57cec5SDimitry Andric 887*0b57cec5SDimitry Andric size_t SBBreakpointList::GetSize() const { 888*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpointList, GetSize); 889*0b57cec5SDimitry Andric 890*0b57cec5SDimitry Andric if (!m_opaque_sp) 891*0b57cec5SDimitry Andric return 0; 892*0b57cec5SDimitry Andric else 893*0b57cec5SDimitry Andric return m_opaque_sp->GetSize(); 894*0b57cec5SDimitry Andric } 895*0b57cec5SDimitry Andric 896*0b57cec5SDimitry Andric SBBreakpoint SBBreakpointList::GetBreakpointAtIndex(size_t idx) { 897*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, GetBreakpointAtIndex, 898*0b57cec5SDimitry Andric (size_t), idx); 899*0b57cec5SDimitry Andric 900*0b57cec5SDimitry Andric if (!m_opaque_sp) 901*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint()); 902*0b57cec5SDimitry Andric 903*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = m_opaque_sp->GetBreakpointAtIndex(idx); 904*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp)); 905*0b57cec5SDimitry Andric } 906*0b57cec5SDimitry Andric 907*0b57cec5SDimitry Andric SBBreakpoint SBBreakpointList::FindBreakpointByID(lldb::break_id_t id) { 908*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, FindBreakpointByID, 909*0b57cec5SDimitry Andric (lldb::break_id_t), id); 910*0b57cec5SDimitry Andric 911*0b57cec5SDimitry Andric if (!m_opaque_sp) 912*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint()); 913*0b57cec5SDimitry Andric BreakpointSP bkpt_sp = m_opaque_sp->FindBreakpointByID(id); 914*0b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp)); 915*0b57cec5SDimitry Andric } 916*0b57cec5SDimitry Andric 917*0b57cec5SDimitry Andric void SBBreakpointList::Append(const SBBreakpoint &sb_bkpt) { 918*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpointList, Append, 919*0b57cec5SDimitry Andric (const lldb::SBBreakpoint &), sb_bkpt); 920*0b57cec5SDimitry Andric 921*0b57cec5SDimitry Andric if (!sb_bkpt.IsValid()) 922*0b57cec5SDimitry Andric return; 923*0b57cec5SDimitry Andric if (!m_opaque_sp) 924*0b57cec5SDimitry Andric return; 925*0b57cec5SDimitry Andric m_opaque_sp->Append(sb_bkpt.m_opaque_wp.lock()); 926*0b57cec5SDimitry Andric } 927*0b57cec5SDimitry Andric 928*0b57cec5SDimitry Andric void SBBreakpointList::AppendByID(lldb::break_id_t id) { 929*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpointList, AppendByID, (lldb::break_id_t), 930*0b57cec5SDimitry Andric id); 931*0b57cec5SDimitry Andric 932*0b57cec5SDimitry Andric if (!m_opaque_sp) 933*0b57cec5SDimitry Andric return; 934*0b57cec5SDimitry Andric m_opaque_sp->AppendByID(id); 935*0b57cec5SDimitry Andric } 936*0b57cec5SDimitry Andric 937*0b57cec5SDimitry Andric bool SBBreakpointList::AppendIfUnique(const SBBreakpoint &sb_bkpt) { 938*0b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpointList, AppendIfUnique, 939*0b57cec5SDimitry Andric (const lldb::SBBreakpoint &), sb_bkpt); 940*0b57cec5SDimitry Andric 941*0b57cec5SDimitry Andric if (!sb_bkpt.IsValid()) 942*0b57cec5SDimitry Andric return false; 943*0b57cec5SDimitry Andric if (!m_opaque_sp) 944*0b57cec5SDimitry Andric return false; 945*0b57cec5SDimitry Andric return m_opaque_sp->AppendIfUnique(sb_bkpt.GetSP()); 946*0b57cec5SDimitry Andric } 947*0b57cec5SDimitry Andric 948*0b57cec5SDimitry Andric void SBBreakpointList::Clear() { 949*0b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpointList, Clear); 950*0b57cec5SDimitry Andric 951*0b57cec5SDimitry Andric if (m_opaque_sp) 952*0b57cec5SDimitry Andric m_opaque_sp->Clear(); 953*0b57cec5SDimitry Andric } 954*0b57cec5SDimitry Andric 955*0b57cec5SDimitry Andric void SBBreakpointList::CopyToBreakpointIDList( 956*0b57cec5SDimitry Andric lldb_private::BreakpointIDList &bp_id_list) { 957*0b57cec5SDimitry Andric if (m_opaque_sp) 958*0b57cec5SDimitry Andric m_opaque_sp->CopyToBreakpointIDList(bp_id_list); 959*0b57cec5SDimitry Andric } 960*0b57cec5SDimitry Andric 961*0b57cec5SDimitry Andric namespace lldb_private { 962*0b57cec5SDimitry Andric namespace repro { 963*0b57cec5SDimitry Andric 964*0b57cec5SDimitry Andric template <> 965*0b57cec5SDimitry Andric void RegisterMethods<SBBreakpoint>(Registry &R) { 966*0b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, ()); 967*0b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &)); 968*0b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &)); 969*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(const lldb::SBBreakpoint &, 970*0b57cec5SDimitry Andric SBBreakpoint, operator=,(const lldb::SBBreakpoint &)); 971*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, 972*0b57cec5SDimitry Andric SBBreakpoint, operator==,(const lldb::SBBreakpoint &)); 973*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, 974*0b57cec5SDimitry Andric SBBreakpoint, operator!=,(const lldb::SBBreakpoint &)); 975*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(lldb::break_id_t, SBBreakpoint, GetID, ()); 976*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsValid, ()); 977*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, operator bool, ()); 978*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, ClearAllBreakpointSites, ()); 979*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 980*0b57cec5SDimitry Andric FindLocationByAddress, (lldb::addr_t)); 981*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::break_id_t, SBBreakpoint, 982*0b57cec5SDimitry Andric FindLocationIDByAddress, (lldb::addr_t)); 983*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 984*0b57cec5SDimitry Andric FindLocationByID, (lldb::break_id_t)); 985*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 986*0b57cec5SDimitry Andric GetLocationAtIndex, (uint32_t)); 987*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetEnabled, (bool)); 988*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsEnabled, ()); 989*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetOneShot, (bool)); 990*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsOneShot, ()); 991*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsInternal, ()); 992*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t)); 993*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCondition, (const char *)); 994*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(const char *, SBBreakpoint, GetCondition, ()); 995*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetAutoContinue, (bool)); 996*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetAutoContinue, ()); 997*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetHitCount, ()); 998*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetIgnoreCount, ()); 999*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t)); 1000*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::tid_t, SBBreakpoint, GetThreadID, ()); 1001*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t)); 1002*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetThreadIndex, ()); 1003*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadName, (const char *)); 1004*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetThreadName, ()); 1005*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetQueueName, (const char *)); 1006*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetQueueName, ()); 1007*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumResolvedLocations, 1008*0b57cec5SDimitry Andric ()); 1009*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumLocations, ()); 1010*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCommandLineCommands, 1011*0b57cec5SDimitry Andric (lldb::SBStringList &)); 1012*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetCommandLineCommands, 1013*0b57cec5SDimitry Andric (lldb::SBStringList &)); 1014*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription, 1015*0b57cec5SDimitry Andric (lldb::SBStream &)); 1016*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription, 1017*0b57cec5SDimitry Andric (lldb::SBStream &, bool)); 1018*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddLocation, 1019*0b57cec5SDimitry Andric (lldb::SBAddress &)); 1020*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetScriptCallbackFunction, 1021*0b57cec5SDimitry Andric (const char *)); 1022480093f4SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackFunction, 1023480093f4SDimitry Andric (const char *, SBStructuredData &)); 1024*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody, 1025*0b57cec5SDimitry Andric (const char *)); 1026*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, AddName, (const char *)); 10275ffd83dbSDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddNameWithErrorHandling, 10285ffd83dbSDimitry Andric (const char *)); 1029*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, RemoveName, (const char *)); 1030*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, MatchesName, (const char *)); 1031*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &)); 1032*0b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent, 1033*0b57cec5SDimitry Andric (const lldb::SBEvent &)); 1034*0b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint, 1035*0b57cec5SDimitry Andric GetBreakpointEventTypeFromEvent, 1036*0b57cec5SDimitry Andric (const lldb::SBEvent &)); 1037*0b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint, 1038*0b57cec5SDimitry Andric GetBreakpointFromEvent, 1039*0b57cec5SDimitry Andric (const lldb::SBEvent &)); 1040*0b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, 1041*0b57cec5SDimitry Andric GetBreakpointLocationAtIndexFromEvent, 1042*0b57cec5SDimitry Andric (const lldb::SBEvent &, uint32_t)); 1043*0b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(uint32_t, SBBreakpoint, 1044*0b57cec5SDimitry Andric GetNumBreakpointLocationsFromEvent, 1045*0b57cec5SDimitry Andric (const lldb::SBEvent &)); 1046*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsHardware, ()); 1047*0b57cec5SDimitry Andric } 1048*0b57cec5SDimitry Andric 1049*0b57cec5SDimitry Andric template <> 1050*0b57cec5SDimitry Andric void RegisterMethods<SBBreakpointList>(Registry &R) { 1051*0b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &)); 1052*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpointList, GetSize, ()); 1053*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList, 1054*0b57cec5SDimitry Andric GetBreakpointAtIndex, (size_t)); 1055*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList, 1056*0b57cec5SDimitry Andric FindBreakpointByID, (lldb::break_id_t)); 1057*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpointList, Append, 1058*0b57cec5SDimitry Andric (const lldb::SBBreakpoint &)); 1059*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpointList, AppendByID, 1060*0b57cec5SDimitry Andric (lldb::break_id_t)); 1061*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpointList, AppendIfUnique, 1062*0b57cec5SDimitry Andric (const lldb::SBBreakpoint &)); 1063*0b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpointList, Clear, ()); 1064*0b57cec5SDimitry Andric } 1065*0b57cec5SDimitry Andric 1066*0b57cec5SDimitry Andric } 1067*0b57cec5SDimitry Andric } 1068