[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"
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#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"
|
|
|
|
|
|
|
|
#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;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBBreakpoint::SBBreakpoint() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBreakpoint); }
|
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) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &), rhs);
|
|
|
|
}
|
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) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &), bp_sp);
|
|
|
|
}
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(const lldb::SBBreakpoint &,
|
|
|
|
SBBreakpoint, operator=,(const lldb::SBBreakpoint &), rhs);
|
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-12-13 03:25:26 +08:00
|
|
|
bool SBBreakpoint::operator==(const lldb::SBBreakpoint &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(
|
|
|
|
bool, SBBreakpoint, operator==,(const lldb::SBBreakpoint &), rhs);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(
|
|
|
|
bool, SBBreakpoint, operator!=,(const lldb::SBBreakpoint &), rhs);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
break_id_t SBBreakpoint::GetID() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::break_id_t, SBBreakpoint, GetID);
|
|
|
|
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsValid);
|
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 {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, operator bool);
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpoint, ClearAllBreakpointSites);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
|
|
|
|
FindLocationByAddress, (lldb::addr_t), vm_addr);
|
|
|
|
|
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
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::break_id_t, SBBreakpoint, FindLocationIDByAddress,
|
|
|
|
(lldb::addr_t), vm_addr);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint, FindLocationByID,
|
|
|
|
(lldb::break_id_t), bp_loc_id);
|
|
|
|
|
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
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
|
|
|
|
GetLocationAtIndex, (uint32_t), index);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_bp_location);
|
2010-07-24 07:33:17 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void SBBreakpoint::SetEnabled(bool enable) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetEnabled, (bool), enable);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsEnabled);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetOneShot, (bool), one_shot);
|
|
|
|
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsOneShot);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, IsInternal);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t), count);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetCondition, (const char *),
|
|
|
|
condition);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBBreakpoint, GetCondition);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetAutoContinue, (bool),
|
|
|
|
auto_continue);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpoint, GetAutoContinue);
|
|
|
|
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetHitCount);
|
|
|
|
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetIgnoreCount);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t), tid);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::tid_t, SBBreakpoint, GetThreadID);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t), index);
|
|
|
|
|
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->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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpoint, GetThreadIndex);
|
|
|
|
|
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 =
|
2017-02-27 19:05:34 +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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetThreadName, (const char *),
|
|
|
|
thread_name);
|
|
|
|
|
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());
|
|
|
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetThreadName);
|
|
|
|
|
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 =
|
2017-02-27 19:05:34 +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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetQueueName, (const char *),
|
|
|
|
queue_name);
|
|
|
|
|
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->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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpoint, GetQueueName);
|
|
|
|
|
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 =
|
2017-02-27 19:05:34 +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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint,
|
|
|
|
GetNumResolvedLocations);
|
|
|
|
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpoint, GetNumLocations);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &), commands);
|
|
|
|
|
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
|
|
|
|
2017-02-27 19:05:34 +08:00
|
|
|
bkpt_sp->GetOptions()->SetCommandDataCallback(cmd_data_up);
|
2016-09-21 06:54:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::GetCommandLineCommands(SBStringList &commands) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpoint, GetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &), commands);
|
|
|
|
|
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 =
|
2017-02-27 19:05:34 +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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription, (lldb::SBStream &), s);
|
|
|
|
|
2016-09-16 09:41:27 +08:00
|
|
|
return GetDescription(s, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpoint, GetDescription,
|
|
|
|
(lldb::SBStream &, bool), s, include_locations);
|
|
|
|
|
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) {
|
|
|
|
LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, AddLocation,
|
|
|
|
(lldb::SBAddress &), 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.");
|
|
|
|
return LLDB_RECORD_RESULT(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bkpt_sp) {
|
|
|
|
error.SetErrorString("No breakpoint to add a location to.");
|
|
|
|
return LLDB_RECORD_RESULT(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) {
|
|
|
|
error.SetErrorString("Only a scripted resolver can add locations.");
|
|
|
|
return LLDB_RECORD_RESULT(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
return LLDB_RECORD_RESULT(error);
|
|
|
|
}
|
2018-09-14 05:35:32 +08:00
|
|
|
|
2019-03-09 03:09:27 +08:00
|
|
|
void SBBreakpoint ::SetCallback(SBBreakpointHitCallback callback, void *baton) {
|
|
|
|
LLDB_RECORD_DUMMY(void, SBBreakpoint, SetCallback,
|
|
|
|
(lldb::SBBreakpointHitCallback, void *), callback, baton);
|
|
|
|
|
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) {
|
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, SetScriptCallbackFunction,
|
|
|
|
(const char *), callback_function_name);
|
|
|
|
SBStructuredData empty_args;
|
|
|
|
SetScriptCallbackFunction(callback_function_name, empty_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
SBError SBBreakpoint::SetScriptCallbackFunction(
|
|
|
|
const char *callback_function_name,
|
|
|
|
SBStructuredData &extra_args) {
|
|
|
|
LLDB_RECORD_METHOD(SBError, SBBreakpoint, SetScriptCallbackFunction,
|
|
|
|
(const char *, SBStructuredData &), callback_function_name, extra_args);
|
|
|
|
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());
|
|
|
|
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");
|
|
|
|
|
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody,
|
|
|
|
(const char *), callback_body_text);
|
|
|
|
|
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());
|
|
|
|
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");
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_error);
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpoint::AddName(const char *new_name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpoint, AddName, (const char *), new_name);
|
|
|
|
|
2020-06-30 22:37:48 +08:00
|
|
|
SBError status = AddNameWithErrorHandling(new_name);
|
|
|
|
return status.Success();
|
|
|
|
}
|
|
|
|
|
|
|
|
SBError SBBreakpoint::AddNameWithErrorHandling(const char *new_name) {
|
|
|
|
LLDB_RECORD_METHOD(SBError, SBBreakpoint, AddNameWithErrorHandling,
|
|
|
|
(const char *), new_name);
|
|
|
|
|
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
|
|
|
|
2020-07-02 05:41:04 +08:00
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, RemoveName, (const char *),
|
|
|
|
name_to_remove);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpoint, MatchesName, (const char *), name);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &),
|
|
|
|
names);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent,
|
|
|
|
(const lldb::SBEvent &), event);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint,
|
|
|
|
GetBreakpointEventTypeFromEvent,
|
|
|
|
(const lldb::SBEvent &), event);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint,
|
|
|
|
GetBreakpointFromEvent, (const lldb::SBEvent &),
|
|
|
|
event);
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
if (event.IsValid())
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(
|
|
|
|
SBBreakpoint(Breakpoint::BreakpointEventData::GetBreakpointFromEvent(
|
|
|
|
event.GetSP())));
|
|
|
|
return LLDB_RECORD_RESULT(SBBreakpoint());
|
2010-07-24 07:33:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpointLocation
|
|
|
|
SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
|
|
|
|
uint32_t loc_idx) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
|
|
|
|
GetBreakpointLocationAtIndexFromEvent,
|
|
|
|
(const lldb::SBEvent &, uint32_t), event, loc_idx);
|
|
|
|
|
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));
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(uint32_t, SBBreakpoint,
|
|
|
|
GetNumBreakpointLocationsFromEvent,
|
|
|
|
(const lldb::SBEvent &), event);
|
|
|
|
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpoint, IsHardware);
|
|
|
|
|
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:
|
2016-11-12 05:06:40 +08:00
|
|
|
SBBreakpointListImpl(lldb::TargetSP target_sp) : m_target_wp() {
|
|
|
|
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())) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &), target);
|
|
|
|
}
|
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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpointList, GetSize);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, GetBreakpointAtIndex,
|
|
|
|
(size_t), idx);
|
|
|
|
|
2016-09-15 03:07:35 +08:00
|
|
|
if (!m_opaque_sp)
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBBreakpoint());
|
2016-09-15 03:07:35 +08:00
|
|
|
|
|
|
|
BreakpointSP bkpt_sp = m_opaque_sp->GetBreakpointAtIndex(idx);
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBBreakpointList, FindBreakpointByID,
|
|
|
|
(lldb::break_id_t), id);
|
|
|
|
|
2016-09-16 09:41:27 +08:00
|
|
|
if (!m_opaque_sp)
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBBreakpoint());
|
2016-09-16 09:41:27 +08:00
|
|
|
BreakpointSP bkpt_sp = m_opaque_sp->FindBreakpointByID(id);
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointList, Append,
|
|
|
|
(const lldb::SBBreakpoint &), sb_bkpt);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointList, AppendByID, (lldb::break_id_t),
|
|
|
|
id);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpointList, AppendIfUnique,
|
|
|
|
(const lldb::SBBreakpoint &), sb_bkpt);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBBreakpointList, Clear);
|
|
|
|
|
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);
|
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBBreakpoint>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::SBBreakpoint &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBBreakpoint, (const lldb::BreakpointSP &));
|
|
|
|
LLDB_REGISTER_METHOD(const lldb::SBBreakpoint &,
|
|
|
|
SBBreakpoint, operator=,(const lldb::SBBreakpoint &));
|
|
|
|
LLDB_REGISTER_METHOD(bool,
|
|
|
|
SBBreakpoint, operator==,(const lldb::SBBreakpoint &));
|
|
|
|
LLDB_REGISTER_METHOD(bool,
|
|
|
|
SBBreakpoint, operator!=,(const lldb::SBBreakpoint &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::break_id_t, SBBreakpoint, GetID, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, operator bool, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, ClearAllBreakpointSites, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
|
|
|
|
FindLocationByAddress, (lldb::addr_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::break_id_t, SBBreakpoint,
|
|
|
|
FindLocationIDByAddress, (lldb::addr_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
|
|
|
|
FindLocationByID, (lldb::break_id_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
|
|
|
|
GetLocationAtIndex, (uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetEnabled, (bool));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsEnabled, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetOneShot, (bool));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsOneShot, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, IsInternal, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetIgnoreCount, (uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCondition, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(const char *, SBBreakpoint, GetCondition, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetAutoContinue, (bool));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetAutoContinue, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetHitCount, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetIgnoreCount, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadID, (lldb::tid_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::tid_t, SBBreakpoint, GetThreadID, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadIndex, (uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpoint, GetThreadIndex, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetThreadName, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetThreadName, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetQueueName, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpoint, GetQueueName, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumResolvedLocations,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpoint, GetNumLocations, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription,
|
|
|
|
(lldb::SBStream &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, GetDescription,
|
|
|
|
(lldb::SBStream &, bool));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddLocation,
|
|
|
|
(lldb::SBAddress &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, SetScriptCallbackFunction,
|
|
|
|
(const char *));
|
2019-10-26 05:05:07 +08:00
|
|
|
LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackFunction,
|
|
|
|
(const char *, SBStructuredData &));
|
2019-03-20 01:13:13 +08:00
|
|
|
LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, AddName, (const char *));
|
2020-06-30 22:37:48 +08:00
|
|
|
LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddNameWithErrorHandling,
|
|
|
|
(const char *));
|
2019-03-20 01:13:13 +08:00
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, RemoveName, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpoint, MatchesName, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(bool, SBBreakpoint, EventIsBreakpointEvent,
|
|
|
|
(const lldb::SBEvent &));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(lldb::BreakpointEventType, SBBreakpoint,
|
|
|
|
GetBreakpointEventTypeFromEvent,
|
|
|
|
(const lldb::SBEvent &));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpoint, SBBreakpoint,
|
|
|
|
GetBreakpointFromEvent,
|
|
|
|
(const lldb::SBEvent &));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(lldb::SBBreakpointLocation, SBBreakpoint,
|
|
|
|
GetBreakpointLocationAtIndexFromEvent,
|
|
|
|
(const lldb::SBEvent &, uint32_t));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(uint32_t, SBBreakpoint,
|
|
|
|
GetNumBreakpointLocationsFromEvent,
|
|
|
|
(const lldb::SBEvent &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsHardware, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBBreakpointList>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(size_t, SBBreakpointList, GetSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList,
|
|
|
|
GetBreakpointAtIndex, (size_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointList,
|
|
|
|
FindBreakpointByID, (lldb::break_id_t));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointList, Append,
|
|
|
|
(const lldb::SBBreakpoint &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointList, AppendByID,
|
|
|
|
(lldb::break_id_t));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpointList, AppendIfUnique,
|
|
|
|
(const lldb::SBBreakpoint &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointList, Clear, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|