[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- SBBreakpoint.cpp --------------------------------------------------===//
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBBreakpoint.h"
|
|
|
|
#include "lldb/API/SBBreakpointLocation.h"
|
|
|
|
#include "lldb/API/SBDebugger.h"
|
2010-07-24 07:33:17 +08:00
|
|
|
#include "lldb/API/SBEvent.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/API/SBProcess.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2014-12-17 07:40:14 +08:00
|
|
|
#include "lldb/API/SBStringList.h"
|
2019-10-26 05:05:07 +08:00
|
|
|
#include "lldb/API/SBStructuredData.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/API/SBThread.h"
|
2022-01-20 03:38:26 +08:00
|
|
|
#include "lldb/Utility/Instrumentation.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
#include "lldb/Breakpoint/Breakpoint.h"
|
2016-09-15 03:07:35 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointIDList.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.h"
|
2018-09-14 05:35:32 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointResolver.h"
|
|
|
|
#include "lldb/Breakpoint/BreakpointResolverScripted.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Breakpoint/StoppointCallbackContext.h"
|
|
|
|
#include "lldb/Core/Address.h"
|
2014-04-02 09:04:55 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/StreamFile.h"
|
2019-10-26 05:05:07 +08:00
|
|
|
#include "lldb/Core/StructuredDataImpl.h"
|
2014-04-02 09:04:55 +08:00
|
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
|
|
|
#include "lldb/Interpreter/ScriptInterpreter.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Process.h"
|
2013-12-06 09:12:00 +08:00
|
|
|
#include "lldb/Target/SectionLoadList.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-18 09:47:08 +08:00
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
#include "lldb/Target/ThreadSpec.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2017-09-15 04:22:49 +08:00
|
|
|
#include "SBBreakpointOptionCommon.h"
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/lldb-enumerations.h"
|
|
|
|
|
2016-09-14 01:53:38 +08:00
|
|
|
#include "llvm/ADT/STLExtras.h"
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2022-01-20 03:38:26 +08:00
|
|
|
SBBreakpoint::SBBreakpoint() { LLDB_INSTRUMENT_VA(this); }
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
SBBreakpoint::SBBreakpoint(const SBBreakpoint &rhs)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_wp(rhs.m_opaque_wp) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
SBBreakpoint::SBBreakpoint(const lldb::BreakpointSP &bp_sp)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_wp(bp_sp) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, bp_sp);
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
SBBreakpoint::~SBBreakpoint() = default;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
const SBBreakpoint &SBBreakpoint::operator=(const SBBreakpoint &rhs) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2022-01-10 14:54:08 +08:00
|
|
|
return *this;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-12-13 03:25:26 +08:00
|
|
|
bool SBBreakpoint::operator==(const lldb::SBBreakpoint &rhs) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
return m_opaque_wp.lock() == rhs.m_opaque_wp.lock();
|
2010-12-13 03:25:26 +08:00
|
|
|
}
|
|
|
|
|
2013-05-03 09:29:27 +08:00
|
|
|
bool SBBreakpoint::operator!=(const lldb::SBBreakpoint &rhs) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
return m_opaque_wp.lock() != rhs.m_opaque_wp.lock();
|
2013-05-03 09:29:27 +08:00
|
|
|
}
|
|
|
|
|
2020-10-16 05:28:06 +08:00
|
|
|
SBTarget SBBreakpoint::GetTarget() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2020-10-16 05:28:06 +08:00
|
|
|
|
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp)
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBTarget(bkpt_sp->GetTargetSP());
|
2020-10-16 05:28:06 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBTarget();
|
2020-10-16 05:28:06 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
break_id_t SBBreakpoint::GetID() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-12-21 04:49:23 +08:00
|
|
|
break_id_t break_id = LLDB_INVALID_BREAK_ID;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp)
|
|
|
|
break_id = bkpt_sp->GetID();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-05-19 13:13:57 +08:00
|
|
|
return break_id;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::IsValid() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBBreakpoint::operator bool() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (!bkpt_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
return false;
|
2017-02-27 19:05:34 +08:00
|
|
|
else if (bkpt_sp->GetTarget().GetBreakpointByID(bkpt_sp->GetID()))
|
2010-12-21 04:49:23 +08:00
|
|
|
return true;
|
2015-10-31 09:22:59 +08:00
|
|
|
else
|
2010-12-21 04:49:23 +08:00
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpoint::ClearAllBreakpointSites() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
bkpt_sp->ClearAllBreakpointSites();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpointLocation SBBreakpoint::FindLocationByAddress(addr_t vm_addr) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, vm_addr);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBBreakpointLocation sb_bp_location;
|
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2013-03-28 07:08:40 +08:00
|
|
|
if (vm_addr != LLDB_INVALID_ADDRESS) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2010-06-09 00:52:24 +08:00
|
|
|
Address address;
|
2017-02-27 19:05:34 +08:00
|
|
|
Target &target = bkpt_sp->GetTarget();
|
2010-06-23 09:19:29 +08:00
|
|
|
if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
|
2012-02-24 09:59:29 +08:00
|
|
|
address.SetRawAddress(vm_addr);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2017-02-27 19:05:34 +08:00
|
|
|
sb_bp_location.SetLocation(bkpt_sp->FindLocationByAddress(address));
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return sb_bp_location;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-10-06 03:16:31 +08:00
|
|
|
break_id_t SBBreakpoint::FindLocationIDByAddress(addr_t vm_addr) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, vm_addr);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
break_id_t break_id = LLDB_INVALID_BREAK_ID;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2012-10-06 03:16:31 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp && vm_addr != LLDB_INVALID_ADDRESS) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2012-10-06 03:16:31 +08:00
|
|
|
Address address;
|
2017-02-27 19:05:34 +08:00
|
|
|
Target &target = bkpt_sp->GetTarget();
|
2012-10-06 03:16:31 +08:00
|
|
|
if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
|
2012-02-24 09:59:29 +08:00
|
|
|
address.SetRawAddress(vm_addr);
|
2012-10-06 03:16:31 +08:00
|
|
|
}
|
2017-02-27 19:05:34 +08:00
|
|
|
break_id = bkpt_sp->FindLocationIDByAddress(address);
|
2012-10-06 03:16:31 +08:00
|
|
|
}
|
|
|
|
|
2012-09-26 07:55:19 +08:00
|
|
|
return break_id;
|
|
|
|
}
|
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
SBBreakpointLocation SBBreakpoint::FindLocationByID(break_id_t bp_loc_id) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, bp_loc_id);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
SBBreakpointLocation sb_bp_location;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2014-04-04 12:06:10 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
sb_bp_location.SetLocation(bkpt_sp->FindLocationByID(bp_loc_id));
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return sb_bp_location;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-22 09:15:49 +08:00
|
|
|
SBBreakpointLocation SBBreakpoint::GetLocationAtIndex(uint32_t index) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, index);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-12-21 04:49:23 +08:00
|
|
|
SBBreakpointLocation sb_bp_location;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2010-10-22 09:15:49 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
sb_bp_location.SetLocation(bkpt_sp->GetLocationAtIndex(index));
|
2010-10-22 09:15:49 +08:00
|
|
|
}
|
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return sb_bp_location;
|
2010-07-24 07:33:17 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void SBBreakpoint::SetEnabled(bool enable) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, enable);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2010-10-30 12:51:46 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2010-10-30 12:51:46 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
bkpt_sp->SetEnabled(enable);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
bool SBBreakpoint::IsEnabled() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
return bkpt_sp->IsEnabled();
|
2010-06-09 00:52:24 +08:00
|
|
|
} else
|
2013-03-28 07:08:40 +08:00
|
|
|
return false;
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpoint::SetOneShot(bool one_shot) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, one_shot);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2010-06-18 09:47:08 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
bkpt_sp->SetOneShot(one_shot);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-09-20 13:20:02 +08:00
|
|
|
}
|
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
bool SBBreakpoint::IsOneShot() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2012-02-21 08:09:25 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
return bkpt_sp->IsOneShot();
|
2010-06-09 00:52:24 +08:00
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::IsInternal() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
return bkpt_sp->IsInternal();
|
2010-06-23 09:19:29 +08:00
|
|
|
} else
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
void SBBreakpoint::SetIgnoreCount(uint32_t count) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, count);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2014-04-02 09:04:55 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
bkpt_sp->SetIgnoreCount(count);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
void SBBreakpoint::SetCondition(const char *condition) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, condition);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2014-04-02 09:04:55 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
bkpt_sp->SetCondition(condition);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 09:15:49 +08:00
|
|
|
const char *SBBreakpoint::GetCondition() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
return bkpt_sp->GetConditionText();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-04-02 09:04:55 +08:00
|
|
|
return nullptr;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2017-08-04 02:13:24 +08:00
|
|
|
void SBBreakpoint::SetAutoContinue(bool auto_continue) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, auto_continue);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-08-04 02:13:24 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
bkpt_sp->SetAutoContinue(auto_continue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::GetAutoContinue() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-08-04 02:13:24 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
return bkpt_sp->IsAutoContinue();
|
|
|
|
}
|
2017-08-04 03:38:38 +08:00
|
|
|
return false;
|
2017-08-04 02:13:24 +08:00
|
|
|
}
|
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
uint32_t SBBreakpoint::GetHitCount() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
uint32_t count = 0;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
count = bkpt_sp->GetHitCount();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
return count;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
uint32_t SBBreakpoint::GetIgnoreCount() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
uint32_t count = 0;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
count = bkpt_sp->GetIgnoreCount();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
return count;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2014-04-04 12:06:10 +08:00
|
|
|
void SBBreakpoint::SetThreadID(tid_t tid) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, tid);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
bkpt_sp->SetThreadID(tid);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
tid_t SBBreakpoint::GetThreadID() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
tid_t tid = LLDB_INVALID_THREAD_ID;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
tid = bkpt_sp->GetThreadID();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
return tid;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-06-18 09:47:08 +08:00
|
|
|
void SBBreakpoint::SetThreadIndex(uint32_t index) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, index);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().GetThreadSpec()->SetIndex(index);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
uint32_t SBBreakpoint::GetThreadIndex() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-12-16 04:50:06 +08:00
|
|
|
uint32_t thread_idx = UINT32_MAX;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2010-12-21 04:49:23 +08:00
|
|
|
const ThreadSpec *thread_spec =
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().GetThreadSpecNoCreate();
|
2015-10-31 09:22:59 +08:00
|
|
|
if (thread_spec != nullptr)
|
2010-10-30 12:51:46 +08:00
|
|
|
thread_idx = thread_spec->GetIndex();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-12-16 05:39:37 +08:00
|
|
|
return thread_idx;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-06-18 09:47:08 +08:00
|
|
|
void SBBreakpoint::SetThreadName(const char *thread_name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, thread_name);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().GetThreadSpec()->SetName(thread_name);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 09:47:08 +08:00
|
|
|
const char *SBBreakpoint::GetThreadName() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
const char *name = nullptr;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2010-12-21 04:49:23 +08:00
|
|
|
const ThreadSpec *thread_spec =
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().GetThreadSpecNoCreate();
|
2015-10-31 09:22:59 +08:00
|
|
|
if (thread_spec != nullptr)
|
2010-10-30 12:51:46 +08:00
|
|
|
name = thread_spec->GetName();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
return name;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-06-18 09:47:08 +08:00
|
|
|
void SBBreakpoint::SetQueueName(const char *queue_name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, queue_name);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().GetThreadSpec()->SetQueueName(queue_name);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 09:47:08 +08:00
|
|
|
const char *SBBreakpoint::GetQueueName() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
const char *name = nullptr;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2010-12-21 04:49:23 +08:00
|
|
|
const ThreadSpec *thread_spec =
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().GetThreadSpecNoCreate();
|
2010-12-21 04:49:23 +08:00
|
|
|
if (thread_spec)
|
2010-10-30 12:51:46 +08:00
|
|
|
name = thread_spec->GetQueueName();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
return name;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
size_t SBBreakpoint::GetNumResolvedLocations() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
size_t num_resolved = 0;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
num_resolved = bkpt_sp->GetNumResolvedLocations();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-30 12:51:46 +08:00
|
|
|
return num_resolved;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
size_t SBBreakpoint::GetNumLocations() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2010-10-30 12:51:46 +08:00
|
|
|
size_t num_locs = 0;
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
num_locs = bkpt_sp->GetNumLocations();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-30 12:51:46 +08:00
|
|
|
return num_locs;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-21 06:54:49 +08:00
|
|
|
void SBBreakpoint::SetCommandLineCommands(SBStringList &commands) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, commands);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (!bkpt_sp)
|
2016-09-21 06:54:49 +08:00
|
|
|
return;
|
|
|
|
if (commands.GetSize() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2016-09-21 06:54:49 +08:00
|
|
|
std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
|
2016-09-27 03:47:37 +08:00
|
|
|
new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
|
2016-09-21 06:54:49 +08:00
|
|
|
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().SetCommandDataCallback(cmd_data_up);
|
2016-09-21 06:54:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::GetCommandLineCommands(SBStringList &commands) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, commands);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (!bkpt_sp)
|
2016-09-21 06:54:49 +08:00
|
|
|
return false;
|
|
|
|
StringList command_list;
|
|
|
|
bool has_commands =
|
2021-06-12 08:00:46 +08:00
|
|
|
bkpt_sp->GetOptions().GetCommandLineCallbacks(command_list);
|
2016-09-21 06:54:49 +08:00
|
|
|
if (has_commands)
|
|
|
|
commands.AppendList(command_list);
|
|
|
|
return has_commands;
|
|
|
|
}
|
|
|
|
|
2010-10-07 12:19:01 +08:00
|
|
|
bool SBBreakpoint::GetDescription(SBStream &s) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, s);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-16 09:41:27 +08:00
|
|
|
return GetDescription(s, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, s, include_locations);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
s.Printf("SBBreakpoint: id = %i, ", bkpt_sp->GetID());
|
|
|
|
bkpt_sp->GetResolverDescription(s.get());
|
|
|
|
bkpt_sp->GetFilterDescription(s.get());
|
2016-09-16 09:41:27 +08:00
|
|
|
if (include_locations) {
|
2017-02-27 19:05:34 +08:00
|
|
|
const size_t num_locations = bkpt_sp->GetNumLocations();
|
2016-09-16 09:41:27 +08:00
|
|
|
s.Printf(", locations = %" PRIu64, (uint64_t)num_locations);
|
|
|
|
}
|
2010-10-07 12:19:01 +08:00
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-07 12:19:01 +08:00
|
|
|
s.Printf("No value");
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBError SBBreakpoint::AddLocation(SBAddress &address) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, address);
|
2018-09-14 05:35:32 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
SBError error;
|
|
|
|
|
|
|
|
if (!address.IsValid()) {
|
|
|
|
error.SetErrorString("Can't add an invalid address.");
|
2022-01-10 14:54:08 +08:00
|
|
|
return error;
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!bkpt_sp) {
|
|
|
|
error.SetErrorString("No breakpoint to add a location to.");
|
2022-01-10 14:54:08 +08:00
|
|
|
return error;
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) {
|
|
|
|
error.SetErrorString("Only a scripted resolver can add locations.");
|
2022-01-10 14:54:08 +08:00
|
|
|
return error;
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bkpt_sp->GetSearchFilter()->AddressPasses(address.ref()))
|
|
|
|
bkpt_sp->AddLocation(address.ref());
|
|
|
|
else {
|
|
|
|
StreamString s;
|
|
|
|
address.get()->Dump(&s, &bkpt_sp->GetTarget(),
|
|
|
|
Address::DumpStyleModuleWithFileAddress);
|
|
|
|
error.SetErrorStringWithFormat("Address: %s didn't pass the filter.",
|
|
|
|
s.GetData());
|
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return error;
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2018-09-14 05:35:32 +08:00
|
|
|
|
2020-09-12 02:09:44 +08:00
|
|
|
SBStructuredData SBBreakpoint::SerializeToStructuredData() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2020-09-12 02:09:44 +08:00
|
|
|
|
|
|
|
SBStructuredData data;
|
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
|
|
|
|
if (!bkpt_sp)
|
2022-01-10 14:54:08 +08:00
|
|
|
return data;
|
2020-09-12 02:09:44 +08:00
|
|
|
|
|
|
|
StructuredData::ObjectSP bkpt_dict = bkpt_sp->SerializeToStructuredData();
|
|
|
|
data.m_impl_up->SetObjectSP(bkpt_dict);
|
2022-01-10 14:54:08 +08:00
|
|
|
return data;
|
2020-09-12 02:09:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpoint::SetCallback(SBBreakpointHitCallback callback, void *baton) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, callback, baton);
|
2019-03-09 03:09:27 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2010-06-09 00:52:24 +08:00
|
|
|
BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
|
2017-09-15 04:22:49 +08:00
|
|
|
bkpt_sp->SetCallback(SBBreakpointCallbackBaton
|
|
|
|
::PrivateBreakpointHitCallback, baton_sp,
|
2017-02-27 19:05:34 +08:00
|
|
|
false);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
void SBBreakpoint::SetScriptCallbackFunction(
|
2019-10-26 05:05:07 +08:00
|
|
|
const char *callback_function_name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, callback_function_name);
|
2019-10-26 05:05:07 +08:00
|
|
|
SBStructuredData empty_args;
|
|
|
|
SetScriptCallbackFunction(callback_function_name, empty_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
SBError SBBreakpoint::SetScriptCallbackFunction(
|
|
|
|
const char *callback_function_name,
|
|
|
|
SBStructuredData &extra_args) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, callback_function_name, extra_args);
|
2019-10-26 05:05:07 +08:00
|
|
|
SBError sb_error;
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2019-10-26 05:05:07 +08:00
|
|
|
Status error;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2021-06-12 08:00:46 +08:00
|
|
|
BreakpointOptions &bp_options = bkpt_sp->GetOptions();
|
2019-10-26 05:05:07 +08:00
|
|
|
error = bkpt_sp->GetTarget()
|
2014-04-02 09:04:55 +08:00
|
|
|
.GetDebugger()
|
|
|
|
.GetScriptInterpreter()
|
|
|
|
->SetBreakpointCommandCallbackFunction(bp_options,
|
2019-10-26 05:05:07 +08:00
|
|
|
callback_function_name,
|
|
|
|
extra_args.m_impl_up
|
|
|
|
->GetObjectSP());
|
|
|
|
sb_error.SetError(error);
|
|
|
|
} else
|
|
|
|
sb_error.SetErrorString("invalid breakpoint");
|
2022-01-10 14:54:08 +08:00
|
|
|
|
|
|
|
return sb_error;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, callback_body_text);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
SBError sb_error;
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2021-06-12 08:00:46 +08:00
|
|
|
BreakpointOptions &bp_options = bkpt_sp->GetOptions();
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error =
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget()
|
2014-04-02 09:04:55 +08:00
|
|
|
.GetDebugger()
|
|
|
|
.GetScriptInterpreter()
|
2014-04-04 12:06:10 +08:00
|
|
|
->SetBreakpointCommandCallback(bp_options, callback_body_text);
|
2014-04-02 09:04:55 +08:00
|
|
|
sb_error.SetError(error);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
2014-04-02 09:04:55 +08:00
|
|
|
sb_error.SetErrorString("invalid breakpoint");
|
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return sb_error;
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::AddName(const char *new_name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, new_name);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-06-30 22:37:48 +08:00
|
|
|
SBError status = AddNameWithErrorHandling(new_name);
|
|
|
|
return status.Success();
|
|
|
|
}
|
|
|
|
|
|
|
|
SBError SBBreakpoint::AddNameWithErrorHandling(const char *new_name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, new_name);
|
2020-06-30 22:37:48 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2020-06-30 22:37:48 +08:00
|
|
|
SBError status;
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2020-06-30 22:37:48 +08:00
|
|
|
Status error;
|
2017-09-15 04:22:49 +08:00
|
|
|
bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name, error);
|
2020-06-30 22:37:48 +08:00
|
|
|
status.SetError(error);
|
|
|
|
} else {
|
|
|
|
status.SetErrorString("invalid breakpoint");
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return status;
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2014-12-17 07:40:14 +08:00
|
|
|
void SBBreakpoint::RemoveName(const char *name_to_remove) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, name_to_remove);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2014-12-17 07:40:14 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2019-03-08 06:47:13 +08:00
|
|
|
bkpt_sp->GetTarget().RemoveNameFromBreakpoint(bkpt_sp,
|
|
|
|
ConstString(name_to_remove));
|
2014-12-17 07:40:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::MatchesName(const char *name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, name);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2014-12-17 07:40:14 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2014-12-17 07:40:14 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
|
|
|
return bkpt_sp->MatchesName(name);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-12-17 07:40:14 +08:00
|
|
|
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-12-17 07:40:14 +08:00
|
|
|
|
2016-05-19 13:13:57 +08:00
|
|
|
void SBBreakpoint::GetNames(SBStringList &names) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, names);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
2014-12-17 07:40:14 +08:00
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetTarget().GetAPIMutex());
|
2014-12-17 07:40:14 +08:00
|
|
|
std::vector<std::string> names_vec;
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetNames(names_vec);
|
2014-12-17 07:40:14 +08:00
|
|
|
for (std::string name : names_vec) {
|
|
|
|
names.AppendString(name.c_str());
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-12-17 07:40:14 +08:00
|
|
|
}
|
|
|
|
|
2012-02-08 13:23:15 +08:00
|
|
|
bool SBBreakpoint::EventIsBreakpointEvent(const lldb::SBEvent &event) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
return Breakpoint::BreakpointEventData::GetEventDataFromEvent(event.get()) !=
|
|
|
|
nullptr;
|
2012-02-08 13:23:15 +08:00
|
|
|
}
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
BreakpointEventType
|
|
|
|
SBBreakpoint::GetBreakpointEventTypeFromEvent(const SBEvent &event) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
if (event.IsValid())
|
|
|
|
return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent(
|
|
|
|
event.GetSP());
|
|
|
|
return eBreakpointEventTypeInvalidType;
|
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpoint SBBreakpoint::GetBreakpointFromEvent(const lldb::SBEvent &event) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
if (event.IsValid())
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBBreakpoint(
|
|
|
|
Breakpoint::BreakpointEventData::GetBreakpointFromEvent(event.GetSP()));
|
|
|
|
return SBBreakpoint();
|
2010-07-24 07:33:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpointLocation
|
|
|
|
SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
|
|
|
|
uint32_t loc_idx) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event, loc_idx);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
SBBreakpointLocation sb_breakpoint_loc;
|
|
|
|
if (event.IsValid())
|
|
|
|
sb_breakpoint_loc.SetLocation(
|
|
|
|
Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent(
|
|
|
|
event.GetSP(), loc_idx));
|
2022-01-10 14:54:08 +08:00
|
|
|
return sb_breakpoint_loc;
|
2010-07-24 07:33:17 +08:00
|
|
|
}
|
|
|
|
|
2012-02-08 13:23:15 +08:00
|
|
|
uint32_t
|
|
|
|
SBBreakpoint::GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-08 13:23:15 +08:00
|
|
|
uint32_t num_locations = 0;
|
|
|
|
if (event.IsValid())
|
|
|
|
num_locations =
|
|
|
|
(Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent(
|
|
|
|
event.GetSP()));
|
|
|
|
return num_locations;
|
|
|
|
}
|
2016-09-15 03:07:35 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
bool SBBreakpoint::IsHardware() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
BreakpointSP bkpt_sp = GetSP();
|
|
|
|
if (bkpt_sp)
|
|
|
|
return bkpt_sp->IsHardware();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); }
|
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
// This is simple collection of breakpoint id's and their target.
|
2016-11-12 05:06:40 +08:00
|
|
|
class SBBreakpointListImpl {
|
2016-09-15 03:07:35 +08:00
|
|
|
public:
|
2022-01-03 14:44:15 +08:00
|
|
|
SBBreakpointListImpl(lldb::TargetSP target_sp) {
|
2016-11-12 05:06:40 +08:00
|
|
|
if (target_sp && target_sp->IsValid())
|
|
|
|
m_target_wp = target_sp;
|
2016-09-15 03:07:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
~SBBreakpointListImpl() = default;
|
|
|
|
|
|
|
|
size_t GetSize() { return m_break_ids.size(); }
|
|
|
|
|
|
|
|
BreakpointSP GetBreakpointAtIndex(size_t idx) {
|
|
|
|
if (idx >= m_break_ids.size())
|
|
|
|
return BreakpointSP();
|
|
|
|
TargetSP target_sp = m_target_wp.lock();
|
|
|
|
if (!target_sp)
|
|
|
|
return BreakpointSP();
|
|
|
|
lldb::break_id_t bp_id = m_break_ids[idx];
|
|
|
|
return target_sp->GetBreakpointList().FindBreakpointByID(bp_id);
|
|
|
|
}
|
|
|
|
|
2016-09-16 09:41:27 +08:00
|
|
|
BreakpointSP FindBreakpointByID(lldb::break_id_t desired_id) {
|
|
|
|
TargetSP target_sp = m_target_wp.lock();
|
|
|
|
if (!target_sp)
|
|
|
|
return BreakpointSP();
|
|
|
|
|
|
|
|
for (lldb::break_id_t &break_id : m_break_ids) {
|
|
|
|
if (break_id == desired_id)
|
|
|
|
return target_sp->GetBreakpointList().FindBreakpointByID(break_id);
|
|
|
|
}
|
|
|
|
return BreakpointSP();
|
|
|
|
}
|
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
bool Append(BreakpointSP bkpt) {
|
2016-09-15 03:07:35 +08:00
|
|
|
TargetSP target_sp = m_target_wp.lock();
|
2017-02-27 19:05:34 +08:00
|
|
|
if (!target_sp || !bkpt)
|
2016-09-15 03:07:35 +08:00
|
|
|
return false;
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt->GetTargetSP() != target_sp)
|
2016-09-15 03:07:35 +08:00
|
|
|
return false;
|
2017-02-27 19:05:34 +08:00
|
|
|
m_break_ids.push_back(bkpt->GetID());
|
2016-09-15 03:07:35 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
bool AppendIfUnique(BreakpointSP bkpt) {
|
2016-09-15 03:07:35 +08:00
|
|
|
TargetSP target_sp = m_target_wp.lock();
|
2017-02-27 19:05:34 +08:00
|
|
|
if (!target_sp || !bkpt)
|
2016-09-15 03:07:35 +08:00
|
|
|
return false;
|
2017-02-27 19:05:34 +08:00
|
|
|
if (bkpt->GetTargetSP() != target_sp)
|
2016-09-15 03:07:35 +08:00
|
|
|
return false;
|
2017-02-27 19:05:34 +08:00
|
|
|
lldb::break_id_t bp_id = bkpt->GetID();
|
2016-09-15 03:07:35 +08:00
|
|
|
if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) ==
|
|
|
|
m_break_ids.end())
|
|
|
|
return false;
|
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
m_break_ids.push_back(bkpt->GetID());
|
2016-09-15 03:07:35 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AppendByID(lldb::break_id_t id) {
|
|
|
|
TargetSP target_sp = m_target_wp.lock();
|
|
|
|
if (!target_sp)
|
|
|
|
return false;
|
|
|
|
if (id == LLDB_INVALID_BREAK_ID)
|
|
|
|
return false;
|
|
|
|
m_break_ids.push_back(id);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Clear() { m_break_ids.clear(); }
|
|
|
|
|
|
|
|
void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_list) {
|
|
|
|
for (lldb::break_id_t id : m_break_ids) {
|
|
|
|
bp_list.AddBreakpointID(BreakpointID(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TargetSP GetTarget() { return m_target_wp.lock(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<lldb::break_id_t> m_break_ids;
|
|
|
|
TargetWP m_target_wp;
|
|
|
|
};
|
|
|
|
|
|
|
|
SBBreakpointList::SBBreakpointList(SBTarget &target)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_sp(new SBBreakpointListImpl(target.GetSP())) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, target);
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2016-09-15 03:07:35 +08:00
|
|
|
|
2020-02-18 14:57:06 +08:00
|
|
|
SBBreakpointList::~SBBreakpointList() = default;
|
2016-09-15 03:07:35 +08:00
|
|
|
|
|
|
|
size_t SBBreakpointList::GetSize() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
if (!m_opaque_sp)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return m_opaque_sp->GetSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpoint SBBreakpointList::GetBreakpointAtIndex(size_t idx) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, idx);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
if (!m_opaque_sp)
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBBreakpoint();
|
2016-09-15 03:07:35 +08:00
|
|
|
|
|
|
|
BreakpointSP bkpt_sp = m_opaque_sp->GetBreakpointAtIndex(idx);
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBBreakpoint(bkpt_sp);
|
2016-09-15 03:07:35 +08:00
|
|
|
}
|
|
|
|
|
2016-09-16 09:41:27 +08:00
|
|
|
SBBreakpoint SBBreakpointList::FindBreakpointByID(lldb::break_id_t id) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, id);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-16 09:41:27 +08:00
|
|
|
if (!m_opaque_sp)
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBBreakpoint();
|
2016-09-16 09:41:27 +08:00
|
|
|
BreakpointSP bkpt_sp = m_opaque_sp->FindBreakpointByID(id);
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBBreakpoint(bkpt_sp);
|
2016-09-16 09:41:27 +08:00
|
|
|
}
|
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
void SBBreakpointList::Append(const SBBreakpoint &sb_bkpt) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_bkpt);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
if (!sb_bkpt.IsValid())
|
|
|
|
return;
|
|
|
|
if (!m_opaque_sp)
|
|
|
|
return;
|
2017-02-27 19:05:34 +08:00
|
|
|
m_opaque_sp->Append(sb_bkpt.m_opaque_wp.lock());
|
2016-09-15 03:07:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointList::AppendByID(lldb::break_id_t id) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, id);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
if (!m_opaque_sp)
|
|
|
|
return;
|
|
|
|
m_opaque_sp->AppendByID(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointList::AppendIfUnique(const SBBreakpoint &sb_bkpt) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_bkpt);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
if (!sb_bkpt.IsValid())
|
|
|
|
return false;
|
|
|
|
if (!m_opaque_sp)
|
|
|
|
return false;
|
2017-02-27 19:05:34 +08:00
|
|
|
return m_opaque_sp->AppendIfUnique(sb_bkpt.GetSP());
|
2016-09-15 03:07:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointList::Clear() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointList::CopyToBreakpointIDList(
|
|
|
|
lldb_private::BreakpointIDList &bp_id_list) {
|
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->CopyToBreakpointIDList(bp_id_list);
|
|
|
|
}
|