15ffd83dbSDimitry Andric //===-- SBBreakpoint.cpp --------------------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric #include "lldb/API/SBBreakpoint.h"
100b57cec5SDimitry Andric #include "SBReproducerPrivate.h"
110b57cec5SDimitry Andric #include "lldb/API/SBBreakpointLocation.h"
120b57cec5SDimitry Andric #include "lldb/API/SBDebugger.h"
130b57cec5SDimitry Andric #include "lldb/API/SBEvent.h"
140b57cec5SDimitry Andric #include "lldb/API/SBProcess.h"
150b57cec5SDimitry Andric #include "lldb/API/SBStream.h"
160b57cec5SDimitry Andric #include "lldb/API/SBStringList.h"
17480093f4SDimitry Andric #include "lldb/API/SBStructuredData.h"
180b57cec5SDimitry Andric #include "lldb/API/SBThread.h"
190b57cec5SDimitry Andric
200b57cec5SDimitry Andric #include "lldb/Breakpoint/Breakpoint.h"
210b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointIDList.h"
220b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointLocation.h"
230b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointResolver.h"
240b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointResolverScripted.h"
250b57cec5SDimitry Andric #include "lldb/Breakpoint/StoppointCallbackContext.h"
260b57cec5SDimitry Andric #include "lldb/Core/Address.h"
270b57cec5SDimitry Andric #include "lldb/Core/Debugger.h"
280b57cec5SDimitry Andric #include "lldb/Core/StreamFile.h"
29480093f4SDimitry Andric #include "lldb/Core/StructuredDataImpl.h"
300b57cec5SDimitry Andric #include "lldb/Interpreter/CommandInterpreter.h"
310b57cec5SDimitry Andric #include "lldb/Interpreter/ScriptInterpreter.h"
320b57cec5SDimitry Andric #include "lldb/Target/Process.h"
330b57cec5SDimitry Andric #include "lldb/Target/SectionLoadList.h"
340b57cec5SDimitry Andric #include "lldb/Target/Target.h"
350b57cec5SDimitry Andric #include "lldb/Target/Thread.h"
360b57cec5SDimitry Andric #include "lldb/Target/ThreadSpec.h"
370b57cec5SDimitry Andric #include "lldb/Utility/Stream.h"
380b57cec5SDimitry Andric
390b57cec5SDimitry Andric #include "SBBreakpointOptionCommon.h"
400b57cec5SDimitry Andric
410b57cec5SDimitry Andric #include "lldb/lldb-enumerations.h"
420b57cec5SDimitry Andric
430b57cec5SDimitry Andric #include "llvm/ADT/STLExtras.h"
440b57cec5SDimitry Andric
450b57cec5SDimitry Andric using namespace lldb;
460b57cec5SDimitry Andric using namespace lldb_private;
470b57cec5SDimitry Andric
SBBreakpoint()480b57cec5SDimitry Andric SBBreakpoint::SBBreakpoint() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBreakpoint); }
490b57cec5SDimitry Andric
SBBreakpoint(const SBBreakpoint & rhs)500b57cec5SDimitry Andric SBBreakpoint::SBBreakpoint(const SBBreakpoint &rhs)
510b57cec5SDimitry Andric : m_opaque_wp(rhs.m_opaque_wp) {
520b57cec5SDimitry Andric LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &), rhs);
530b57cec5SDimitry Andric }
540b57cec5SDimitry Andric
SBBreakpoint(const lldb::BreakpointSP & bp_sp)550b57cec5SDimitry Andric SBBreakpoint::SBBreakpoint(const lldb::BreakpointSP &bp_sp)
560b57cec5SDimitry Andric : m_opaque_wp(bp_sp) {
570b57cec5SDimitry Andric LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &), bp_sp);
580b57cec5SDimitry Andric }
590b57cec5SDimitry Andric
600b57cec5SDimitry Andric SBBreakpoint::~SBBreakpoint() = default;
610b57cec5SDimitry Andric
operator =(const SBBreakpoint & rhs)620b57cec5SDimitry Andric const SBBreakpoint &SBBreakpoint::operator=(const SBBreakpoint &rhs) {
630b57cec5SDimitry Andric LLDB_RECORD_METHOD(const lldb::SBBreakpoint &,
640b57cec5SDimitry Andric SBBreakpoint, operator=,(const lldb::SBBreakpoint &), rhs);
650b57cec5SDimitry Andric
660b57cec5SDimitry Andric m_opaque_wp = rhs.m_opaque_wp;
670b57cec5SDimitry Andric return LLDB_RECORD_RESULT(*this);
680b57cec5SDimitry Andric }
690b57cec5SDimitry Andric
operator ==(const lldb::SBBreakpoint & rhs)700b57cec5SDimitry Andric bool SBBreakpoint::operator==(const lldb::SBBreakpoint &rhs) {
710b57cec5SDimitry Andric LLDB_RECORD_METHOD(
720b57cec5SDimitry Andric bool, SBBreakpoint, operator==,(const lldb::SBBreakpoint &), rhs);
730b57cec5SDimitry Andric
740b57cec5SDimitry Andric return m_opaque_wp.lock() == rhs.m_opaque_wp.lock();
750b57cec5SDimitry Andric }
760b57cec5SDimitry Andric
operator !=(const lldb::SBBreakpoint & rhs)770b57cec5SDimitry Andric bool SBBreakpoint::operator!=(const lldb::SBBreakpoint &rhs) {
780b57cec5SDimitry Andric LLDB_RECORD_METHOD(
790b57cec5SDimitry Andric bool, SBBreakpoint, operator!=,(const lldb::SBBreakpoint &), rhs);
800b57cec5SDimitry Andric
810b57cec5SDimitry Andric return m_opaque_wp.lock() != rhs.m_opaque_wp.lock();
820b57cec5SDimitry Andric }
830b57cec5SDimitry Andric
GetTarget() const84af732203SDimitry Andric SBTarget SBBreakpoint::GetTarget() const {
85af732203SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBTarget, SBBreakpoint, GetTarget);
86af732203SDimitry Andric
87af732203SDimitry Andric BreakpointSP bkpt_sp = GetSP();
88af732203SDimitry Andric if (bkpt_sp)
89af732203SDimitry Andric return LLDB_RECORD_RESULT(SBTarget(bkpt_sp->GetTargetSP()));
90af732203SDimitry Andric
91af732203SDimitry Andric return LLDB_RECORD_RESULT(SBTarget());
92af732203SDimitry Andric }
93af732203SDimitry Andric
GetID() const940b57cec5SDimitry Andric break_id_t SBBreakpoint::GetID() const {
950b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::break_id_t, SBBreakpoint, GetID);
960b57cec5SDimitry Andric
970b57cec5SDimitry Andric break_id_t break_id = LLDB_INVALID_BREAK_ID;
980b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
990b57cec5SDimitry Andric if (bkpt_sp)
1000b57cec5SDimitry Andric break_id = bkpt_sp->GetID();
1010b57cec5SDimitry Andric
1020b57cec5SDimitry Andric return break_id;
1030b57cec5SDimitry Andric }
1040b57cec5SDimitry Andric
IsValid() const1050b57cec5SDimitry Andric bool SBBreakpoint::IsValid() const {
1060b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsValid);
1070b57cec5SDimitry Andric return this->operator bool();
1080b57cec5SDimitry Andric }
operator bool() const1090b57cec5SDimitry Andric SBBreakpoint::operator bool() const {
1100b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, operator bool);
1110b57cec5SDimitry Andric
1120b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
1130b57cec5SDimitry Andric if (!bkpt_sp)
1140b57cec5SDimitry Andric return false;
1150b57cec5SDimitry Andric else if (bkpt_sp->GetTarget().GetBreakpointByID(bkpt_sp->GetID()))
1160b57cec5SDimitry Andric return true;
1170b57cec5SDimitry Andric else
1180b57cec5SDimitry Andric return false;
1190b57cec5SDimitry Andric }
1200b57cec5SDimitry Andric
ClearAllBreakpointSites()1210b57cec5SDimitry Andric void SBBreakpoint::ClearAllBreakpointSites() {
1220b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpoint, ClearAllBreakpointSites);
1230b57cec5SDimitry Andric
1240b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
1250b57cec5SDimitry Andric if (bkpt_sp) {
1260b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
1270b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
1280b57cec5SDimitry Andric bkpt_sp->ClearAllBreakpointSites();
1290b57cec5SDimitry Andric }
1300b57cec5SDimitry Andric }
1310b57cec5SDimitry Andric
FindLocationByAddress(addr_t vm_addr)1320b57cec5SDimitry Andric SBBreakpointLocation SBBreakpoint::FindLocationByAddress(addr_t vm_addr) {
1330b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
1340b57cec5SDimitry Andric FindLocationByAddress, (lldb::addr_t), vm_addr);
1350b57cec5SDimitry Andric
1360b57cec5SDimitry Andric SBBreakpointLocation sb_bp_location;
1370b57cec5SDimitry Andric
1380b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
1390b57cec5SDimitry Andric if (bkpt_sp) {
1400b57cec5SDimitry Andric if (vm_addr != LLDB_INVALID_ADDRESS) {
1410b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
1420b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
1430b57cec5SDimitry Andric Address address;
1440b57cec5SDimitry Andric Target &target = bkpt_sp->GetTarget();
1450b57cec5SDimitry Andric if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
1460b57cec5SDimitry Andric address.SetRawAddress(vm_addr);
1470b57cec5SDimitry Andric }
1480b57cec5SDimitry Andric sb_bp_location.SetLocation(bkpt_sp->FindLocationByAddress(address));
1490b57cec5SDimitry Andric }
1500b57cec5SDimitry Andric }
1510b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_bp_location);
1520b57cec5SDimitry Andric }
1530b57cec5SDimitry Andric
FindLocationIDByAddress(addr_t vm_addr)1540b57cec5SDimitry Andric break_id_t SBBreakpoint::FindLocationIDByAddress(addr_t vm_addr) {
1550b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::break_id_t, SBBreakpoint, FindLocationIDByAddress,
1560b57cec5SDimitry Andric (lldb::addr_t), vm_addr);
1570b57cec5SDimitry Andric
1580b57cec5SDimitry Andric break_id_t break_id = LLDB_INVALID_BREAK_ID;
1590b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
1600b57cec5SDimitry Andric
1610b57cec5SDimitry Andric if (bkpt_sp && vm_addr != LLDB_INVALID_ADDRESS) {
1620b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
1630b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
1640b57cec5SDimitry Andric Address address;
1650b57cec5SDimitry Andric Target &target = bkpt_sp->GetTarget();
1660b57cec5SDimitry Andric if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
1670b57cec5SDimitry Andric address.SetRawAddress(vm_addr);
1680b57cec5SDimitry Andric }
1690b57cec5SDimitry Andric break_id = bkpt_sp->FindLocationIDByAddress(address);
1700b57cec5SDimitry Andric }
1710b57cec5SDimitry Andric
1720b57cec5SDimitry Andric return break_id;
1730b57cec5SDimitry Andric }
1740b57cec5SDimitry Andric
FindLocationByID(break_id_t bp_loc_id)1750b57cec5SDimitry Andric SBBreakpointLocation SBBreakpoint::FindLocationByID(break_id_t bp_loc_id) {
1760b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, FindLocationByID,
1770b57cec5SDimitry Andric (lldb::break_id_t), bp_loc_id);
1780b57cec5SDimitry Andric
1790b57cec5SDimitry Andric SBBreakpointLocation sb_bp_location;
1800b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
1810b57cec5SDimitry Andric
1820b57cec5SDimitry Andric if (bkpt_sp) {
1830b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
1840b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
1850b57cec5SDimitry Andric sb_bp_location.SetLocation(bkpt_sp->FindLocationByID(bp_loc_id));
1860b57cec5SDimitry Andric }
1870b57cec5SDimitry Andric
1880b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_bp_location);
1890b57cec5SDimitry Andric }
1900b57cec5SDimitry Andric
GetLocationAtIndex(uint32_t index)1910b57cec5SDimitry Andric SBBreakpointLocation SBBreakpoint::GetLocationAtIndex(uint32_t index) {
1920b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
1930b57cec5SDimitry Andric GetLocationAtIndex, (uint32_t), index);
1940b57cec5SDimitry Andric
1950b57cec5SDimitry Andric SBBreakpointLocation sb_bp_location;
1960b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andric if (bkpt_sp) {
1990b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2000b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2010b57cec5SDimitry Andric sb_bp_location.SetLocation(bkpt_sp->GetLocationAtIndex(index));
2020b57cec5SDimitry Andric }
2030b57cec5SDimitry Andric
2040b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_bp_location);
2050b57cec5SDimitry Andric }
2060b57cec5SDimitry Andric
SetEnabled(bool enable)2070b57cec5SDimitry Andric void SBBreakpoint::SetEnabled(bool enable) {
2080b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetEnabled, (bool), enable);
2090b57cec5SDimitry Andric
2100b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2110b57cec5SDimitry Andric
2120b57cec5SDimitry Andric if (bkpt_sp) {
2130b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2140b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2150b57cec5SDimitry Andric bkpt_sp->SetEnabled(enable);
2160b57cec5SDimitry Andric }
2170b57cec5SDimitry Andric }
2180b57cec5SDimitry Andric
IsEnabled()2190b57cec5SDimitry Andric bool SBBreakpoint::IsEnabled() {
2200b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsEnabled);
2210b57cec5SDimitry Andric
2220b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2230b57cec5SDimitry Andric if (bkpt_sp) {
2240b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2250b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2260b57cec5SDimitry Andric return bkpt_sp->IsEnabled();
2270b57cec5SDimitry Andric } else
2280b57cec5SDimitry Andric return false;
2290b57cec5SDimitry Andric }
2300b57cec5SDimitry Andric
SetOneShot(bool one_shot)2310b57cec5SDimitry Andric void SBBreakpoint::SetOneShot(bool one_shot) {
2320b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetOneShot, (bool), one_shot);
2330b57cec5SDimitry Andric
2340b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2350b57cec5SDimitry Andric
2360b57cec5SDimitry Andric if (bkpt_sp) {
2370b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2380b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2390b57cec5SDimitry Andric bkpt_sp->SetOneShot(one_shot);
2400b57cec5SDimitry Andric }
2410b57cec5SDimitry Andric }
2420b57cec5SDimitry Andric
IsOneShot() const2430b57cec5SDimitry Andric bool SBBreakpoint::IsOneShot() const {
2440b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsOneShot);
2450b57cec5SDimitry Andric
2460b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2470b57cec5SDimitry Andric if (bkpt_sp) {
2480b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2490b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2500b57cec5SDimitry Andric return bkpt_sp->IsOneShot();
2510b57cec5SDimitry Andric } else
2520b57cec5SDimitry Andric return false;
2530b57cec5SDimitry Andric }
2540b57cec5SDimitry Andric
IsInternal()2550b57cec5SDimitry Andric bool SBBreakpoint::IsInternal() {
2560b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsInternal);
2570b57cec5SDimitry Andric
2580b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2590b57cec5SDimitry Andric if (bkpt_sp) {
2600b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2610b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2620b57cec5SDimitry Andric return bkpt_sp->IsInternal();
2630b57cec5SDimitry Andric } else
2640b57cec5SDimitry Andric return false;
2650b57cec5SDimitry Andric }
2660b57cec5SDimitry Andric
SetIgnoreCount(uint32_t count)2670b57cec5SDimitry Andric void SBBreakpoint::SetIgnoreCount(uint32_t count) {
2680b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t), count);
2690b57cec5SDimitry Andric
2700b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2710b57cec5SDimitry Andric
2720b57cec5SDimitry Andric if (bkpt_sp) {
2730b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2740b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2750b57cec5SDimitry Andric bkpt_sp->SetIgnoreCount(count);
2760b57cec5SDimitry Andric }
2770b57cec5SDimitry Andric }
2780b57cec5SDimitry Andric
SetCondition(const char * condition)2790b57cec5SDimitry Andric void SBBreakpoint::SetCondition(const char *condition) {
2800b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetCondition, (const char *),
2810b57cec5SDimitry Andric condition);
2820b57cec5SDimitry Andric
2830b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2840b57cec5SDimitry Andric if (bkpt_sp) {
2850b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2860b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2870b57cec5SDimitry Andric bkpt_sp->SetCondition(condition);
2880b57cec5SDimitry Andric }
2890b57cec5SDimitry Andric }
2900b57cec5SDimitry Andric
GetCondition()2910b57cec5SDimitry Andric const char *SBBreakpoint::GetCondition() {
2920b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(const char *, SBBreakpoint, GetCondition);
2930b57cec5SDimitry Andric
2940b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
2950b57cec5SDimitry Andric if (bkpt_sp) {
2960b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
2970b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
2980b57cec5SDimitry Andric return bkpt_sp->GetConditionText();
2990b57cec5SDimitry Andric }
3000b57cec5SDimitry Andric return nullptr;
3010b57cec5SDimitry Andric }
3020b57cec5SDimitry Andric
SetAutoContinue(bool auto_continue)3030b57cec5SDimitry Andric void SBBreakpoint::SetAutoContinue(bool auto_continue) {
3040b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetAutoContinue, (bool),
3050b57cec5SDimitry Andric auto_continue);
3060b57cec5SDimitry Andric
3070b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3080b57cec5SDimitry Andric if (bkpt_sp) {
3090b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3100b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
3110b57cec5SDimitry Andric bkpt_sp->SetAutoContinue(auto_continue);
3120b57cec5SDimitry Andric }
3130b57cec5SDimitry Andric }
3140b57cec5SDimitry Andric
GetAutoContinue()3150b57cec5SDimitry Andric bool SBBreakpoint::GetAutoContinue() {
3160b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, GetAutoContinue);
3170b57cec5SDimitry Andric
3180b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3190b57cec5SDimitry Andric if (bkpt_sp) {
3200b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3210b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
3220b57cec5SDimitry Andric return bkpt_sp->IsAutoContinue();
3230b57cec5SDimitry Andric }
3240b57cec5SDimitry Andric return false;
3250b57cec5SDimitry Andric }
3260b57cec5SDimitry Andric
GetHitCount() const3270b57cec5SDimitry Andric uint32_t SBBreakpoint::GetHitCount() const {
3280b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetHitCount);
3290b57cec5SDimitry Andric
3300b57cec5SDimitry Andric uint32_t count = 0;
3310b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3320b57cec5SDimitry Andric if (bkpt_sp) {
3330b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3340b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
3350b57cec5SDimitry Andric count = bkpt_sp->GetHitCount();
3360b57cec5SDimitry Andric }
3370b57cec5SDimitry Andric
3380b57cec5SDimitry Andric return count;
3390b57cec5SDimitry Andric }
3400b57cec5SDimitry Andric
GetIgnoreCount() const3410b57cec5SDimitry Andric uint32_t SBBreakpoint::GetIgnoreCount() const {
3420b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetIgnoreCount);
3430b57cec5SDimitry Andric
3440b57cec5SDimitry Andric uint32_t count = 0;
3450b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3460b57cec5SDimitry Andric if (bkpt_sp) {
3470b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3480b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
3490b57cec5SDimitry Andric count = bkpt_sp->GetIgnoreCount();
3500b57cec5SDimitry Andric }
3510b57cec5SDimitry Andric
3520b57cec5SDimitry Andric return count;
3530b57cec5SDimitry Andric }
3540b57cec5SDimitry Andric
SetThreadID(tid_t tid)3550b57cec5SDimitry Andric void SBBreakpoint::SetThreadID(tid_t tid) {
3560b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t), tid);
3570b57cec5SDimitry Andric
3580b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3590b57cec5SDimitry Andric if (bkpt_sp) {
3600b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3610b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
3620b57cec5SDimitry Andric bkpt_sp->SetThreadID(tid);
3630b57cec5SDimitry Andric }
3640b57cec5SDimitry Andric }
3650b57cec5SDimitry Andric
GetThreadID()3660b57cec5SDimitry Andric tid_t SBBreakpoint::GetThreadID() {
3670b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(lldb::tid_t, SBBreakpoint, GetThreadID);
3680b57cec5SDimitry Andric
3690b57cec5SDimitry Andric tid_t tid = LLDB_INVALID_THREAD_ID;
3700b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3710b57cec5SDimitry Andric if (bkpt_sp) {
3720b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3730b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
3740b57cec5SDimitry Andric tid = bkpt_sp->GetThreadID();
3750b57cec5SDimitry Andric }
3760b57cec5SDimitry Andric
3770b57cec5SDimitry Andric return tid;
3780b57cec5SDimitry Andric }
3790b57cec5SDimitry Andric
SetThreadIndex(uint32_t index)3800b57cec5SDimitry Andric void SBBreakpoint::SetThreadIndex(uint32_t index) {
3810b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t), index);
3820b57cec5SDimitry Andric
3830b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3840b57cec5SDimitry Andric if (bkpt_sp) {
3850b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3860b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
387*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().GetThreadSpec()->SetIndex(index);
3880b57cec5SDimitry Andric }
3890b57cec5SDimitry Andric }
3900b57cec5SDimitry Andric
GetThreadIndex() const3910b57cec5SDimitry Andric uint32_t SBBreakpoint::GetThreadIndex() const {
3920b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetThreadIndex);
3930b57cec5SDimitry Andric
3940b57cec5SDimitry Andric uint32_t thread_idx = UINT32_MAX;
3950b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
3960b57cec5SDimitry Andric if (bkpt_sp) {
3970b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
3980b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
3990b57cec5SDimitry Andric const ThreadSpec *thread_spec =
400*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().GetThreadSpecNoCreate();
4010b57cec5SDimitry Andric if (thread_spec != nullptr)
4020b57cec5SDimitry Andric thread_idx = thread_spec->GetIndex();
4030b57cec5SDimitry Andric }
4040b57cec5SDimitry Andric
4050b57cec5SDimitry Andric return thread_idx;
4060b57cec5SDimitry Andric }
4070b57cec5SDimitry Andric
SetThreadName(const char * thread_name)4080b57cec5SDimitry Andric void SBBreakpoint::SetThreadName(const char *thread_name) {
4090b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadName, (const char *),
4100b57cec5SDimitry Andric thread_name);
4110b57cec5SDimitry Andric
4120b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
4130b57cec5SDimitry Andric
4140b57cec5SDimitry Andric if (bkpt_sp) {
4150b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
4160b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
417*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().GetThreadSpec()->SetName(thread_name);
4180b57cec5SDimitry Andric }
4190b57cec5SDimitry Andric }
4200b57cec5SDimitry Andric
GetThreadName() const4210b57cec5SDimitry Andric const char *SBBreakpoint::GetThreadName() const {
4220b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetThreadName);
4230b57cec5SDimitry Andric
4240b57cec5SDimitry Andric const char *name = nullptr;
4250b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
4260b57cec5SDimitry Andric if (bkpt_sp) {
4270b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
4280b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
4290b57cec5SDimitry Andric const ThreadSpec *thread_spec =
430*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().GetThreadSpecNoCreate();
4310b57cec5SDimitry Andric if (thread_spec != nullptr)
4320b57cec5SDimitry Andric name = thread_spec->GetName();
4330b57cec5SDimitry Andric }
4340b57cec5SDimitry Andric
4350b57cec5SDimitry Andric return name;
4360b57cec5SDimitry Andric }
4370b57cec5SDimitry Andric
SetQueueName(const char * queue_name)4380b57cec5SDimitry Andric void SBBreakpoint::SetQueueName(const char *queue_name) {
4390b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetQueueName, (const char *),
4400b57cec5SDimitry Andric queue_name);
4410b57cec5SDimitry Andric
4420b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
4430b57cec5SDimitry Andric if (bkpt_sp) {
4440b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
4450b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
446*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().GetThreadSpec()->SetQueueName(queue_name);
4470b57cec5SDimitry Andric }
4480b57cec5SDimitry Andric }
4490b57cec5SDimitry Andric
GetQueueName() const4500b57cec5SDimitry Andric const char *SBBreakpoint::GetQueueName() const {
4510b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetQueueName);
4520b57cec5SDimitry Andric
4530b57cec5SDimitry Andric const char *name = nullptr;
4540b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
4550b57cec5SDimitry Andric if (bkpt_sp) {
4560b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
4570b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
4580b57cec5SDimitry Andric const ThreadSpec *thread_spec =
459*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().GetThreadSpecNoCreate();
4600b57cec5SDimitry Andric if (thread_spec)
4610b57cec5SDimitry Andric name = thread_spec->GetQueueName();
4620b57cec5SDimitry Andric }
4630b57cec5SDimitry Andric
4640b57cec5SDimitry Andric return name;
4650b57cec5SDimitry Andric }
4660b57cec5SDimitry Andric
GetNumResolvedLocations() const4670b57cec5SDimitry Andric size_t SBBreakpoint::GetNumResolvedLocations() const {
4680b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint,
4690b57cec5SDimitry Andric GetNumResolvedLocations);
4700b57cec5SDimitry Andric
4710b57cec5SDimitry Andric size_t num_resolved = 0;
4720b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
4730b57cec5SDimitry Andric if (bkpt_sp) {
4740b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
4750b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
4760b57cec5SDimitry Andric num_resolved = bkpt_sp->GetNumResolvedLocations();
4770b57cec5SDimitry Andric }
4780b57cec5SDimitry Andric return num_resolved;
4790b57cec5SDimitry Andric }
4800b57cec5SDimitry Andric
GetNumLocations() const4810b57cec5SDimitry Andric size_t SBBreakpoint::GetNumLocations() const {
4820b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint, GetNumLocations);
4830b57cec5SDimitry Andric
4840b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
4850b57cec5SDimitry Andric size_t num_locs = 0;
4860b57cec5SDimitry Andric if (bkpt_sp) {
4870b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
4880b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
4890b57cec5SDimitry Andric num_locs = bkpt_sp->GetNumLocations();
4900b57cec5SDimitry Andric }
4910b57cec5SDimitry Andric return num_locs;
4920b57cec5SDimitry Andric }
4930b57cec5SDimitry Andric
SetCommandLineCommands(SBStringList & commands)4940b57cec5SDimitry Andric void SBBreakpoint::SetCommandLineCommands(SBStringList &commands) {
4950b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetCommandLineCommands,
4960b57cec5SDimitry Andric (lldb::SBStringList &), commands);
4970b57cec5SDimitry Andric
4980b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
4990b57cec5SDimitry Andric if (!bkpt_sp)
5000b57cec5SDimitry Andric return;
5010b57cec5SDimitry Andric if (commands.GetSize() == 0)
5020b57cec5SDimitry Andric return;
5030b57cec5SDimitry Andric
5040b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
5050b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
5060b57cec5SDimitry Andric std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
5070b57cec5SDimitry Andric new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
5080b57cec5SDimitry Andric
509*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().SetCommandDataCallback(cmd_data_up);
5100b57cec5SDimitry Andric }
5110b57cec5SDimitry Andric
GetCommandLineCommands(SBStringList & commands)5120b57cec5SDimitry Andric bool SBBreakpoint::GetCommandLineCommands(SBStringList &commands) {
5130b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, GetCommandLineCommands,
5140b57cec5SDimitry Andric (lldb::SBStringList &), commands);
5150b57cec5SDimitry Andric
5160b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
5170b57cec5SDimitry Andric if (!bkpt_sp)
5180b57cec5SDimitry Andric return false;
5190b57cec5SDimitry Andric StringList command_list;
5200b57cec5SDimitry Andric bool has_commands =
521*5f7ddb14SDimitry Andric bkpt_sp->GetOptions().GetCommandLineCallbacks(command_list);
5220b57cec5SDimitry Andric if (has_commands)
5230b57cec5SDimitry Andric commands.AppendList(command_list);
5240b57cec5SDimitry Andric return has_commands;
5250b57cec5SDimitry Andric }
5260b57cec5SDimitry Andric
GetDescription(SBStream & s)5270b57cec5SDimitry Andric bool SBBreakpoint::GetDescription(SBStream &s) {
5280b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription, (lldb::SBStream &), s);
5290b57cec5SDimitry Andric
5300b57cec5SDimitry Andric return GetDescription(s, true);
5310b57cec5SDimitry Andric }
5320b57cec5SDimitry Andric
GetDescription(SBStream & s,bool include_locations)5330b57cec5SDimitry Andric bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) {
5340b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription,
5350b57cec5SDimitry Andric (lldb::SBStream &, bool), s, include_locations);
5360b57cec5SDimitry Andric
5370b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
5380b57cec5SDimitry Andric if (bkpt_sp) {
5390b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
5400b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
5410b57cec5SDimitry Andric s.Printf("SBBreakpoint: id = %i, ", bkpt_sp->GetID());
5420b57cec5SDimitry Andric bkpt_sp->GetResolverDescription(s.get());
5430b57cec5SDimitry Andric bkpt_sp->GetFilterDescription(s.get());
5440b57cec5SDimitry Andric if (include_locations) {
5450b57cec5SDimitry Andric const size_t num_locations = bkpt_sp->GetNumLocations();
5460b57cec5SDimitry Andric s.Printf(", locations = %" PRIu64, (uint64_t)num_locations);
5470b57cec5SDimitry Andric }
5480b57cec5SDimitry Andric return true;
5490b57cec5SDimitry Andric }
5500b57cec5SDimitry Andric s.Printf("No value");
5510b57cec5SDimitry Andric return false;
5520b57cec5SDimitry Andric }
5530b57cec5SDimitry Andric
AddLocation(SBAddress & address)5540b57cec5SDimitry Andric SBError SBBreakpoint::AddLocation(SBAddress &address) {
5550b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, AddLocation,
5560b57cec5SDimitry Andric (lldb::SBAddress &), address);
5570b57cec5SDimitry Andric
5580b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
5590b57cec5SDimitry Andric SBError error;
5600b57cec5SDimitry Andric
5610b57cec5SDimitry Andric if (!address.IsValid()) {
5620b57cec5SDimitry Andric error.SetErrorString("Can't add an invalid address.");
5630b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error);
5640b57cec5SDimitry Andric }
5650b57cec5SDimitry Andric
5660b57cec5SDimitry Andric if (!bkpt_sp) {
5670b57cec5SDimitry Andric error.SetErrorString("No breakpoint to add a location to.");
5680b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error);
5690b57cec5SDimitry Andric }
5700b57cec5SDimitry Andric
5710b57cec5SDimitry Andric if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) {
5720b57cec5SDimitry Andric error.SetErrorString("Only a scripted resolver can add locations.");
5730b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error);
5740b57cec5SDimitry Andric }
5750b57cec5SDimitry Andric
5760b57cec5SDimitry Andric if (bkpt_sp->GetSearchFilter()->AddressPasses(address.ref()))
5770b57cec5SDimitry Andric bkpt_sp->AddLocation(address.ref());
5780b57cec5SDimitry Andric else {
5790b57cec5SDimitry Andric StreamString s;
5800b57cec5SDimitry Andric address.get()->Dump(&s, &bkpt_sp->GetTarget(),
5810b57cec5SDimitry Andric Address::DumpStyleModuleWithFileAddress);
5820b57cec5SDimitry Andric error.SetErrorStringWithFormat("Address: %s didn't pass the filter.",
5830b57cec5SDimitry Andric s.GetData());
5840b57cec5SDimitry Andric }
5850b57cec5SDimitry Andric return LLDB_RECORD_RESULT(error);
5860b57cec5SDimitry Andric }
5870b57cec5SDimitry Andric
SerializeToStructuredData()588af732203SDimitry Andric SBStructuredData SBBreakpoint::SerializeToStructuredData() {
589af732203SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(lldb::SBStructuredData, SBBreakpoint,
590af732203SDimitry Andric SerializeToStructuredData);
591af732203SDimitry Andric
592af732203SDimitry Andric SBStructuredData data;
593af732203SDimitry Andric BreakpointSP bkpt_sp = GetSP();
594af732203SDimitry Andric
595af732203SDimitry Andric if (!bkpt_sp)
596af732203SDimitry Andric return LLDB_RECORD_RESULT(data);
597af732203SDimitry Andric
598af732203SDimitry Andric StructuredData::ObjectSP bkpt_dict = bkpt_sp->SerializeToStructuredData();
599af732203SDimitry Andric data.m_impl_up->SetObjectSP(bkpt_dict);
600af732203SDimitry Andric return LLDB_RECORD_RESULT(data);
601af732203SDimitry Andric }
602af732203SDimitry Andric
SetCallback(SBBreakpointHitCallback callback,void * baton)6030b57cec5SDimitry Andric void SBBreakpoint::SetCallback(SBBreakpointHitCallback callback, void *baton) {
6040b57cec5SDimitry Andric LLDB_RECORD_DUMMY(void, SBBreakpoint, SetCallback,
6050b57cec5SDimitry Andric (lldb::SBBreakpointHitCallback, void *), callback, baton);
6060b57cec5SDimitry Andric
6070b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
6080b57cec5SDimitry Andric
6090b57cec5SDimitry Andric if (bkpt_sp) {
6100b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
6110b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
6120b57cec5SDimitry Andric BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
6130b57cec5SDimitry Andric bkpt_sp->SetCallback(SBBreakpointCallbackBaton
6140b57cec5SDimitry Andric ::PrivateBreakpointHitCallback, baton_sp,
6150b57cec5SDimitry Andric false);
6160b57cec5SDimitry Andric }
6170b57cec5SDimitry Andric }
6180b57cec5SDimitry Andric
SetScriptCallbackFunction(const char * callback_function_name)6190b57cec5SDimitry Andric void SBBreakpoint::SetScriptCallbackFunction(
6200b57cec5SDimitry Andric const char *callback_function_name) {
6210b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, SetScriptCallbackFunction,
6220b57cec5SDimitry Andric (const char *), callback_function_name);
623480093f4SDimitry Andric SBStructuredData empty_args;
624480093f4SDimitry Andric SetScriptCallbackFunction(callback_function_name, empty_args);
625480093f4SDimitry Andric }
6260b57cec5SDimitry Andric
SetScriptCallbackFunction(const char * callback_function_name,SBStructuredData & extra_args)627480093f4SDimitry Andric SBError SBBreakpoint::SetScriptCallbackFunction(
628480093f4SDimitry Andric const char *callback_function_name,
629480093f4SDimitry Andric SBStructuredData &extra_args) {
630480093f4SDimitry Andric LLDB_RECORD_METHOD(SBError, SBBreakpoint, SetScriptCallbackFunction,
631480093f4SDimitry Andric (const char *, SBStructuredData &), callback_function_name, extra_args);
632480093f4SDimitry Andric SBError sb_error;
6330b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
6340b57cec5SDimitry Andric
6350b57cec5SDimitry Andric if (bkpt_sp) {
636480093f4SDimitry Andric Status error;
6370b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
6380b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
639*5f7ddb14SDimitry Andric BreakpointOptions &bp_options = bkpt_sp->GetOptions();
640480093f4SDimitry Andric error = bkpt_sp->GetTarget()
6410b57cec5SDimitry Andric .GetDebugger()
6420b57cec5SDimitry Andric .GetScriptInterpreter()
6430b57cec5SDimitry Andric ->SetBreakpointCommandCallbackFunction(bp_options,
644480093f4SDimitry Andric callback_function_name,
645480093f4SDimitry Andric extra_args.m_impl_up
646480093f4SDimitry Andric ->GetObjectSP());
647480093f4SDimitry Andric sb_error.SetError(error);
648480093f4SDimitry Andric } else
649480093f4SDimitry Andric sb_error.SetErrorString("invalid breakpoint");
650480093f4SDimitry Andric
651480093f4SDimitry Andric return LLDB_RECORD_RESULT(sb_error);
6520b57cec5SDimitry Andric }
6530b57cec5SDimitry Andric
SetScriptCallbackBody(const char * callback_body_text)6540b57cec5SDimitry Andric SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) {
6550b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody,
6560b57cec5SDimitry Andric (const char *), callback_body_text);
6570b57cec5SDimitry Andric
6580b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
6590b57cec5SDimitry Andric
6600b57cec5SDimitry Andric SBError sb_error;
6610b57cec5SDimitry Andric if (bkpt_sp) {
6620b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
6630b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
664*5f7ddb14SDimitry Andric BreakpointOptions &bp_options = bkpt_sp->GetOptions();
6650b57cec5SDimitry Andric Status error =
6660b57cec5SDimitry Andric bkpt_sp->GetTarget()
6670b57cec5SDimitry Andric .GetDebugger()
6680b57cec5SDimitry Andric .GetScriptInterpreter()
6690b57cec5SDimitry Andric ->SetBreakpointCommandCallback(bp_options, callback_body_text);
6700b57cec5SDimitry Andric sb_error.SetError(error);
6710b57cec5SDimitry Andric } else
6720b57cec5SDimitry Andric sb_error.SetErrorString("invalid breakpoint");
6730b57cec5SDimitry Andric
6740b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_error);
6750b57cec5SDimitry Andric }
6760b57cec5SDimitry Andric
AddName(const char * new_name)6770b57cec5SDimitry Andric bool SBBreakpoint::AddName(const char *new_name) {
6780b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, AddName, (const char *), new_name);
6790b57cec5SDimitry Andric
6805ffd83dbSDimitry Andric SBError status = AddNameWithErrorHandling(new_name);
6815ffd83dbSDimitry Andric return status.Success();
6825ffd83dbSDimitry Andric }
6835ffd83dbSDimitry Andric
AddNameWithErrorHandling(const char * new_name)6845ffd83dbSDimitry Andric SBError SBBreakpoint::AddNameWithErrorHandling(const char *new_name) {
6855ffd83dbSDimitry Andric LLDB_RECORD_METHOD(SBError, SBBreakpoint, AddNameWithErrorHandling,
6865ffd83dbSDimitry Andric (const char *), new_name);
6875ffd83dbSDimitry Andric
6880b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
6890b57cec5SDimitry Andric
6905ffd83dbSDimitry Andric SBError status;
6910b57cec5SDimitry Andric if (bkpt_sp) {
6920b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
6930b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
6945ffd83dbSDimitry Andric Status error;
6950b57cec5SDimitry Andric bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name, error);
6965ffd83dbSDimitry Andric status.SetError(error);
6975ffd83dbSDimitry Andric } else {
6985ffd83dbSDimitry Andric status.SetErrorString("invalid breakpoint");
6990b57cec5SDimitry Andric }
7000b57cec5SDimitry Andric
7015ffd83dbSDimitry Andric return LLDB_RECORD_RESULT(status);
7020b57cec5SDimitry Andric }
7030b57cec5SDimitry Andric
RemoveName(const char * name_to_remove)7040b57cec5SDimitry Andric void SBBreakpoint::RemoveName(const char *name_to_remove) {
7050b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, RemoveName, (const char *),
7060b57cec5SDimitry Andric name_to_remove);
7070b57cec5SDimitry Andric
7080b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
7090b57cec5SDimitry Andric
7100b57cec5SDimitry Andric if (bkpt_sp) {
7110b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
7120b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
7130b57cec5SDimitry Andric bkpt_sp->GetTarget().RemoveNameFromBreakpoint(bkpt_sp,
7140b57cec5SDimitry Andric ConstString(name_to_remove));
7150b57cec5SDimitry Andric }
7160b57cec5SDimitry Andric }
7170b57cec5SDimitry Andric
MatchesName(const char * name)7180b57cec5SDimitry Andric bool SBBreakpoint::MatchesName(const char *name) {
7190b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpoint, MatchesName, (const char *), name);
7200b57cec5SDimitry Andric
7210b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
7220b57cec5SDimitry Andric
7230b57cec5SDimitry Andric if (bkpt_sp) {
7240b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
7250b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
7260b57cec5SDimitry Andric return bkpt_sp->MatchesName(name);
7270b57cec5SDimitry Andric }
7280b57cec5SDimitry Andric
7290b57cec5SDimitry Andric return false;
7300b57cec5SDimitry Andric }
7310b57cec5SDimitry Andric
GetNames(SBStringList & names)7320b57cec5SDimitry Andric void SBBreakpoint::GetNames(SBStringList &names) {
7330b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &),
7340b57cec5SDimitry Andric names);
7350b57cec5SDimitry Andric
7360b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
7370b57cec5SDimitry Andric
7380b57cec5SDimitry Andric if (bkpt_sp) {
7390b57cec5SDimitry Andric std::lock_guard<std::recursive_mutex> guard(
7400b57cec5SDimitry Andric bkpt_sp->GetTarget().GetAPIMutex());
7410b57cec5SDimitry Andric std::vector<std::string> names_vec;
7420b57cec5SDimitry Andric bkpt_sp->GetNames(names_vec);
7430b57cec5SDimitry Andric for (std::string name : names_vec) {
7440b57cec5SDimitry Andric names.AppendString(name.c_str());
7450b57cec5SDimitry Andric }
7460b57cec5SDimitry Andric }
7470b57cec5SDimitry Andric }
7480b57cec5SDimitry Andric
EventIsBreakpointEvent(const lldb::SBEvent & event)7490b57cec5SDimitry Andric bool SBBreakpoint::EventIsBreakpointEvent(const lldb::SBEvent &event) {
7500b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent,
7510b57cec5SDimitry Andric (const lldb::SBEvent &), event);
7520b57cec5SDimitry Andric
7530b57cec5SDimitry Andric return Breakpoint::BreakpointEventData::GetEventDataFromEvent(event.get()) !=
7540b57cec5SDimitry Andric nullptr;
7550b57cec5SDimitry Andric }
7560b57cec5SDimitry Andric
7570b57cec5SDimitry Andric BreakpointEventType
GetBreakpointEventTypeFromEvent(const SBEvent & event)7580b57cec5SDimitry Andric SBBreakpoint::GetBreakpointEventTypeFromEvent(const SBEvent &event) {
7590b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint,
7600b57cec5SDimitry Andric GetBreakpointEventTypeFromEvent,
7610b57cec5SDimitry Andric (const lldb::SBEvent &), event);
7620b57cec5SDimitry Andric
7630b57cec5SDimitry Andric if (event.IsValid())
7640b57cec5SDimitry Andric return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent(
7650b57cec5SDimitry Andric event.GetSP());
7660b57cec5SDimitry Andric return eBreakpointEventTypeInvalidType;
7670b57cec5SDimitry Andric }
7680b57cec5SDimitry Andric
GetBreakpointFromEvent(const lldb::SBEvent & event)7690b57cec5SDimitry Andric SBBreakpoint SBBreakpoint::GetBreakpointFromEvent(const lldb::SBEvent &event) {
7700b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint,
7710b57cec5SDimitry Andric GetBreakpointFromEvent, (const lldb::SBEvent &),
7720b57cec5SDimitry Andric event);
7730b57cec5SDimitry Andric
7740b57cec5SDimitry Andric if (event.IsValid())
7750b57cec5SDimitry Andric return LLDB_RECORD_RESULT(
7760b57cec5SDimitry Andric SBBreakpoint(Breakpoint::BreakpointEventData::GetBreakpointFromEvent(
7770b57cec5SDimitry Andric event.GetSP())));
7780b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint());
7790b57cec5SDimitry Andric }
7800b57cec5SDimitry Andric
7810b57cec5SDimitry Andric SBBreakpointLocation
GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent & event,uint32_t loc_idx)7820b57cec5SDimitry Andric SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
7830b57cec5SDimitry Andric uint32_t loc_idx) {
7840b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
7850b57cec5SDimitry Andric GetBreakpointLocationAtIndexFromEvent,
7860b57cec5SDimitry Andric (const lldb::SBEvent &, uint32_t), event, loc_idx);
7870b57cec5SDimitry Andric
7880b57cec5SDimitry Andric SBBreakpointLocation sb_breakpoint_loc;
7890b57cec5SDimitry Andric if (event.IsValid())
7900b57cec5SDimitry Andric sb_breakpoint_loc.SetLocation(
7910b57cec5SDimitry Andric Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent(
7920b57cec5SDimitry Andric event.GetSP(), loc_idx));
7930b57cec5SDimitry Andric return LLDB_RECORD_RESULT(sb_breakpoint_loc);
7940b57cec5SDimitry Andric }
7950b57cec5SDimitry Andric
7960b57cec5SDimitry Andric uint32_t
GetNumBreakpointLocationsFromEvent(const lldb::SBEvent & event)7970b57cec5SDimitry Andric SBBreakpoint::GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event) {
7980b57cec5SDimitry Andric LLDB_RECORD_STATIC_METHOD(uint32_t, SBBreakpoint,
7990b57cec5SDimitry Andric GetNumBreakpointLocationsFromEvent,
8000b57cec5SDimitry Andric (const lldb::SBEvent &), event);
8010b57cec5SDimitry Andric
8020b57cec5SDimitry Andric uint32_t num_locations = 0;
8030b57cec5SDimitry Andric if (event.IsValid())
8040b57cec5SDimitry Andric num_locations =
8050b57cec5SDimitry Andric (Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent(
8060b57cec5SDimitry Andric event.GetSP()));
8070b57cec5SDimitry Andric return num_locations;
8080b57cec5SDimitry Andric }
8090b57cec5SDimitry Andric
IsHardware() const8100b57cec5SDimitry Andric bool SBBreakpoint::IsHardware() const {
8110b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsHardware);
8120b57cec5SDimitry Andric
8130b57cec5SDimitry Andric BreakpointSP bkpt_sp = GetSP();
8140b57cec5SDimitry Andric if (bkpt_sp)
8150b57cec5SDimitry Andric return bkpt_sp->IsHardware();
8160b57cec5SDimitry Andric return false;
8170b57cec5SDimitry Andric }
8180b57cec5SDimitry Andric
GetSP() const8190b57cec5SDimitry Andric BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); }
8200b57cec5SDimitry Andric
8210b57cec5SDimitry Andric // This is simple collection of breakpoint id's and their target.
8220b57cec5SDimitry Andric class SBBreakpointListImpl {
8230b57cec5SDimitry Andric public:
SBBreakpointListImpl(lldb::TargetSP target_sp)8240b57cec5SDimitry Andric SBBreakpointListImpl(lldb::TargetSP target_sp) : m_target_wp() {
8250b57cec5SDimitry Andric if (target_sp && target_sp->IsValid())
8260b57cec5SDimitry Andric m_target_wp = target_sp;
8270b57cec5SDimitry Andric }
8280b57cec5SDimitry Andric
8290b57cec5SDimitry Andric ~SBBreakpointListImpl() = default;
8300b57cec5SDimitry Andric
GetSize()8310b57cec5SDimitry Andric size_t GetSize() { return m_break_ids.size(); }
8320b57cec5SDimitry Andric
GetBreakpointAtIndex(size_t idx)8330b57cec5SDimitry Andric BreakpointSP GetBreakpointAtIndex(size_t idx) {
8340b57cec5SDimitry Andric if (idx >= m_break_ids.size())
8350b57cec5SDimitry Andric return BreakpointSP();
8360b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock();
8370b57cec5SDimitry Andric if (!target_sp)
8380b57cec5SDimitry Andric return BreakpointSP();
8390b57cec5SDimitry Andric lldb::break_id_t bp_id = m_break_ids[idx];
8400b57cec5SDimitry Andric return target_sp->GetBreakpointList().FindBreakpointByID(bp_id);
8410b57cec5SDimitry Andric }
8420b57cec5SDimitry Andric
FindBreakpointByID(lldb::break_id_t desired_id)8430b57cec5SDimitry Andric BreakpointSP FindBreakpointByID(lldb::break_id_t desired_id) {
8440b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock();
8450b57cec5SDimitry Andric if (!target_sp)
8460b57cec5SDimitry Andric return BreakpointSP();
8470b57cec5SDimitry Andric
8480b57cec5SDimitry Andric for (lldb::break_id_t &break_id : m_break_ids) {
8490b57cec5SDimitry Andric if (break_id == desired_id)
8500b57cec5SDimitry Andric return target_sp->GetBreakpointList().FindBreakpointByID(break_id);
8510b57cec5SDimitry Andric }
8520b57cec5SDimitry Andric return BreakpointSP();
8530b57cec5SDimitry Andric }
8540b57cec5SDimitry Andric
Append(BreakpointSP bkpt)8550b57cec5SDimitry Andric bool Append(BreakpointSP bkpt) {
8560b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock();
8570b57cec5SDimitry Andric if (!target_sp || !bkpt)
8580b57cec5SDimitry Andric return false;
8590b57cec5SDimitry Andric if (bkpt->GetTargetSP() != target_sp)
8600b57cec5SDimitry Andric return false;
8610b57cec5SDimitry Andric m_break_ids.push_back(bkpt->GetID());
8620b57cec5SDimitry Andric return true;
8630b57cec5SDimitry Andric }
8640b57cec5SDimitry Andric
AppendIfUnique(BreakpointSP bkpt)8650b57cec5SDimitry Andric bool AppendIfUnique(BreakpointSP bkpt) {
8660b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock();
8670b57cec5SDimitry Andric if (!target_sp || !bkpt)
8680b57cec5SDimitry Andric return false;
8690b57cec5SDimitry Andric if (bkpt->GetTargetSP() != target_sp)
8700b57cec5SDimitry Andric return false;
8710b57cec5SDimitry Andric lldb::break_id_t bp_id = bkpt->GetID();
8720b57cec5SDimitry Andric if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) ==
8730b57cec5SDimitry Andric m_break_ids.end())
8740b57cec5SDimitry Andric return false;
8750b57cec5SDimitry Andric
8760b57cec5SDimitry Andric m_break_ids.push_back(bkpt->GetID());
8770b57cec5SDimitry Andric return true;
8780b57cec5SDimitry Andric }
8790b57cec5SDimitry Andric
AppendByID(lldb::break_id_t id)8800b57cec5SDimitry Andric bool AppendByID(lldb::break_id_t id) {
8810b57cec5SDimitry Andric TargetSP target_sp = m_target_wp.lock();
8820b57cec5SDimitry Andric if (!target_sp)
8830b57cec5SDimitry Andric return false;
8840b57cec5SDimitry Andric if (id == LLDB_INVALID_BREAK_ID)
8850b57cec5SDimitry Andric return false;
8860b57cec5SDimitry Andric m_break_ids.push_back(id);
8870b57cec5SDimitry Andric return true;
8880b57cec5SDimitry Andric }
8890b57cec5SDimitry Andric
Clear()8900b57cec5SDimitry Andric void Clear() { m_break_ids.clear(); }
8910b57cec5SDimitry Andric
CopyToBreakpointIDList(lldb_private::BreakpointIDList & bp_list)8920b57cec5SDimitry Andric void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_list) {
8930b57cec5SDimitry Andric for (lldb::break_id_t id : m_break_ids) {
8940b57cec5SDimitry Andric bp_list.AddBreakpointID(BreakpointID(id));
8950b57cec5SDimitry Andric }
8960b57cec5SDimitry Andric }
8970b57cec5SDimitry Andric
GetTarget()8980b57cec5SDimitry Andric TargetSP GetTarget() { return m_target_wp.lock(); }
8990b57cec5SDimitry Andric
9000b57cec5SDimitry Andric private:
9010b57cec5SDimitry Andric std::vector<lldb::break_id_t> m_break_ids;
9020b57cec5SDimitry Andric TargetWP m_target_wp;
9030b57cec5SDimitry Andric };
9040b57cec5SDimitry Andric
SBBreakpointList(SBTarget & target)9050b57cec5SDimitry Andric SBBreakpointList::SBBreakpointList(SBTarget &target)
9060b57cec5SDimitry Andric : m_opaque_sp(new SBBreakpointListImpl(target.GetSP())) {
9070b57cec5SDimitry Andric LLDB_RECORD_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &), target);
9080b57cec5SDimitry Andric }
9090b57cec5SDimitry Andric
9105ffd83dbSDimitry Andric SBBreakpointList::~SBBreakpointList() = default;
9110b57cec5SDimitry Andric
GetSize() const9120b57cec5SDimitry Andric size_t SBBreakpointList::GetSize() const {
9130b57cec5SDimitry Andric LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpointList, GetSize);
9140b57cec5SDimitry Andric
9150b57cec5SDimitry Andric if (!m_opaque_sp)
9160b57cec5SDimitry Andric return 0;
9170b57cec5SDimitry Andric else
9180b57cec5SDimitry Andric return m_opaque_sp->GetSize();
9190b57cec5SDimitry Andric }
9200b57cec5SDimitry Andric
GetBreakpointAtIndex(size_t idx)9210b57cec5SDimitry Andric SBBreakpoint SBBreakpointList::GetBreakpointAtIndex(size_t idx) {
9220b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, GetBreakpointAtIndex,
9230b57cec5SDimitry Andric (size_t), idx);
9240b57cec5SDimitry Andric
9250b57cec5SDimitry Andric if (!m_opaque_sp)
9260b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint());
9270b57cec5SDimitry Andric
9280b57cec5SDimitry Andric BreakpointSP bkpt_sp = m_opaque_sp->GetBreakpointAtIndex(idx);
9290b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp));
9300b57cec5SDimitry Andric }
9310b57cec5SDimitry Andric
FindBreakpointByID(lldb::break_id_t id)9320b57cec5SDimitry Andric SBBreakpoint SBBreakpointList::FindBreakpointByID(lldb::break_id_t id) {
9330b57cec5SDimitry Andric LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, FindBreakpointByID,
9340b57cec5SDimitry Andric (lldb::break_id_t), id);
9350b57cec5SDimitry Andric
9360b57cec5SDimitry Andric if (!m_opaque_sp)
9370b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint());
9380b57cec5SDimitry Andric BreakpointSP bkpt_sp = m_opaque_sp->FindBreakpointByID(id);
9390b57cec5SDimitry Andric return LLDB_RECORD_RESULT(SBBreakpoint(bkpt_sp));
9400b57cec5SDimitry Andric }
9410b57cec5SDimitry Andric
Append(const SBBreakpoint & sb_bkpt)9420b57cec5SDimitry Andric void SBBreakpointList::Append(const SBBreakpoint &sb_bkpt) {
9430b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpointList, Append,
9440b57cec5SDimitry Andric (const lldb::SBBreakpoint &), sb_bkpt);
9450b57cec5SDimitry Andric
9460b57cec5SDimitry Andric if (!sb_bkpt.IsValid())
9470b57cec5SDimitry Andric return;
9480b57cec5SDimitry Andric if (!m_opaque_sp)
9490b57cec5SDimitry Andric return;
9500b57cec5SDimitry Andric m_opaque_sp->Append(sb_bkpt.m_opaque_wp.lock());
9510b57cec5SDimitry Andric }
9520b57cec5SDimitry Andric
AppendByID(lldb::break_id_t id)9530b57cec5SDimitry Andric void SBBreakpointList::AppendByID(lldb::break_id_t id) {
9540b57cec5SDimitry Andric LLDB_RECORD_METHOD(void, SBBreakpointList, AppendByID, (lldb::break_id_t),
9550b57cec5SDimitry Andric id);
9560b57cec5SDimitry Andric
9570b57cec5SDimitry Andric if (!m_opaque_sp)
9580b57cec5SDimitry Andric return;
9590b57cec5SDimitry Andric m_opaque_sp->AppendByID(id);
9600b57cec5SDimitry Andric }
9610b57cec5SDimitry Andric
AppendIfUnique(const SBBreakpoint & sb_bkpt)9620b57cec5SDimitry Andric bool SBBreakpointList::AppendIfUnique(const SBBreakpoint &sb_bkpt) {
9630b57cec5SDimitry Andric LLDB_RECORD_METHOD(bool, SBBreakpointList, AppendIfUnique,
9640b57cec5SDimitry Andric (const lldb::SBBreakpoint &), sb_bkpt);
9650b57cec5SDimitry Andric
9660b57cec5SDimitry Andric if (!sb_bkpt.IsValid())
9670b57cec5SDimitry Andric return false;
9680b57cec5SDimitry Andric if (!m_opaque_sp)
9690b57cec5SDimitry Andric return false;
9700b57cec5SDimitry Andric return m_opaque_sp->AppendIfUnique(sb_bkpt.GetSP());
9710b57cec5SDimitry Andric }
9720b57cec5SDimitry Andric
Clear()9730b57cec5SDimitry Andric void SBBreakpointList::Clear() {
9740b57cec5SDimitry Andric LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpointList, Clear);
9750b57cec5SDimitry Andric
9760b57cec5SDimitry Andric if (m_opaque_sp)
9770b57cec5SDimitry Andric m_opaque_sp->Clear();
9780b57cec5SDimitry Andric }
9790b57cec5SDimitry Andric
CopyToBreakpointIDList(lldb_private::BreakpointIDList & bp_id_list)9800b57cec5SDimitry Andric void SBBreakpointList::CopyToBreakpointIDList(
9810b57cec5SDimitry Andric lldb_private::BreakpointIDList &bp_id_list) {
9820b57cec5SDimitry Andric if (m_opaque_sp)
9830b57cec5SDimitry Andric m_opaque_sp->CopyToBreakpointIDList(bp_id_list);
9840b57cec5SDimitry Andric }
9850b57cec5SDimitry Andric
9860b57cec5SDimitry Andric namespace lldb_private {
9870b57cec5SDimitry Andric namespace repro {
9880b57cec5SDimitry Andric
9890b57cec5SDimitry Andric template <>
RegisterMethods(Registry & R)9900b57cec5SDimitry Andric void RegisterMethods<SBBreakpoint>(Registry &R) {
9910b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, ());
9920b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &));
9930b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &));
9940b57cec5SDimitry Andric LLDB_REGISTER_METHOD(const lldb::SBBreakpoint &,
9950b57cec5SDimitry Andric SBBreakpoint, operator=,(const lldb::SBBreakpoint &));
9960b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool,
9970b57cec5SDimitry Andric SBBreakpoint, operator==,(const lldb::SBBreakpoint &));
9980b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool,
9990b57cec5SDimitry Andric SBBreakpoint, operator!=,(const lldb::SBBreakpoint &));
1000af732203SDimitry Andric LLDB_REGISTER_METHOD_CONST(lldb::SBTarget, SBBreakpoint, GetTarget, ());
10010b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(lldb::break_id_t, SBBreakpoint, GetID, ());
10020b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsValid, ());
10030b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, operator bool, ());
10040b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, ClearAllBreakpointSites, ());
10050b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
10060b57cec5SDimitry Andric FindLocationByAddress, (lldb::addr_t));
10070b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::break_id_t, SBBreakpoint,
10080b57cec5SDimitry Andric FindLocationIDByAddress, (lldb::addr_t));
10090b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
10100b57cec5SDimitry Andric FindLocationByID, (lldb::break_id_t));
10110b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
10120b57cec5SDimitry Andric GetLocationAtIndex, (uint32_t));
10130b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetEnabled, (bool));
10140b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsEnabled, ());
10150b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetOneShot, (bool));
10160b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsOneShot, ());
10170b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsInternal, ());
10180b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t));
10190b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCondition, (const char *));
10200b57cec5SDimitry Andric LLDB_REGISTER_METHOD(const char *, SBBreakpoint, GetCondition, ());
10210b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetAutoContinue, (bool));
10220b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetAutoContinue, ());
10230b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetHitCount, ());
10240b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetIgnoreCount, ());
10250b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t));
10260b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::tid_t, SBBreakpoint, GetThreadID, ());
10270b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t));
10280b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetThreadIndex, ());
10290b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadName, (const char *));
10300b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetThreadName, ());
10310b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetQueueName, (const char *));
10320b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetQueueName, ());
10330b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumResolvedLocations,
10340b57cec5SDimitry Andric ());
10350b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumLocations, ());
10360b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCommandLineCommands,
10370b57cec5SDimitry Andric (lldb::SBStringList &));
10380b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetCommandLineCommands,
10390b57cec5SDimitry Andric (lldb::SBStringList &));
10400b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription,
10410b57cec5SDimitry Andric (lldb::SBStream &));
10420b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription,
10430b57cec5SDimitry Andric (lldb::SBStream &, bool));
10440b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddLocation,
10450b57cec5SDimitry Andric (lldb::SBAddress &));
1046af732203SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBStructuredData, SBBreakpoint,
1047af732203SDimitry Andric SerializeToStructuredData, ());
10480b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, SetScriptCallbackFunction,
10490b57cec5SDimitry Andric (const char *));
1050480093f4SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackFunction,
1051480093f4SDimitry Andric (const char *, SBStructuredData &));
10520b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody,
10530b57cec5SDimitry Andric (const char *));
10540b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, AddName, (const char *));
10555ffd83dbSDimitry Andric LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddNameWithErrorHandling,
10565ffd83dbSDimitry Andric (const char *));
10570b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, RemoveName, (const char *));
10580b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpoint, MatchesName, (const char *));
10590b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &));
10600b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent,
10610b57cec5SDimitry Andric (const lldb::SBEvent &));
10620b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint,
10630b57cec5SDimitry Andric GetBreakpointEventTypeFromEvent,
10640b57cec5SDimitry Andric (const lldb::SBEvent &));
10650b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint,
10660b57cec5SDimitry Andric GetBreakpointFromEvent,
10670b57cec5SDimitry Andric (const lldb::SBEvent &));
10680b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
10690b57cec5SDimitry Andric GetBreakpointLocationAtIndexFromEvent,
10700b57cec5SDimitry Andric (const lldb::SBEvent &, uint32_t));
10710b57cec5SDimitry Andric LLDB_REGISTER_STATIC_METHOD(uint32_t, SBBreakpoint,
10720b57cec5SDimitry Andric GetNumBreakpointLocationsFromEvent,
10730b57cec5SDimitry Andric (const lldb::SBEvent &));
10740b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsHardware, ());
10750b57cec5SDimitry Andric }
10760b57cec5SDimitry Andric
10770b57cec5SDimitry Andric template <>
RegisterMethods(Registry & R)10780b57cec5SDimitry Andric void RegisterMethods<SBBreakpointList>(Registry &R) {
10790b57cec5SDimitry Andric LLDB_REGISTER_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &));
10800b57cec5SDimitry Andric LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpointList, GetSize, ());
10810b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList,
10820b57cec5SDimitry Andric GetBreakpointAtIndex, (size_t));
10830b57cec5SDimitry Andric LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList,
10840b57cec5SDimitry Andric FindBreakpointByID, (lldb::break_id_t));
10850b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpointList, Append,
10860b57cec5SDimitry Andric (const lldb::SBBreakpoint &));
10870b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpointList, AppendByID,
10880b57cec5SDimitry Andric (lldb::break_id_t));
10890b57cec5SDimitry Andric LLDB_REGISTER_METHOD(bool, SBBreakpointList, AppendIfUnique,
10900b57cec5SDimitry Andric (const lldb::SBBreakpoint &));
10910b57cec5SDimitry Andric LLDB_REGISTER_METHOD(void, SBBreakpointList, Clear, ());
10920b57cec5SDimitry Andric }
10930b57cec5SDimitry Andric
10940b57cec5SDimitry Andric }
10950b57cec5SDimitry Andric }
1096