[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 08:23:27 +01:00
|
|
|
//===-- SBBreakpointLocation.cpp ------------------------------------------===//
|
2010-06-08 16:52:24 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00: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-08 16:52:24 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBBreakpointLocation.h"
|
2011-09-24 01:37:21 +00:00
|
|
|
#include "lldb/API/SBAddress.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/API/SBDebugger.h"
|
|
|
|
#include "lldb/API/SBDefines.h"
|
2010-09-20 05:20:02 +00:00
|
|
|
#include "lldb/API/SBStream.h"
|
2017-08-02 00:16:10 +00:00
|
|
|
#include "lldb/API/SBStringList.h"
|
2022-01-19 11:38:26 -08:00
|
|
|
#include "lldb/API/SBStructuredData.h"
|
|
|
|
#include "lldb/Utility/Instrumentation.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2010-11-18 18:52:36 +00:00
|
|
|
#include "lldb/Breakpoint/Breakpoint.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.h"
|
2014-04-02 01:04:55 +00:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2019-10-25 14:05:07 -07:00
|
|
|
#include "lldb/Core/StructuredDataImpl.h"
|
2014-04-02 01:04:55 +00:00
|
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
|
|
|
#include "lldb/Interpreter/ScriptInterpreter.h"
|
2010-12-20 20:49:23 +00:00
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-18 01:47:08 +00:00
|
|
|
#include "lldb/Target/ThreadSpec.h"
|
2017-02-02 21:39:50 +00:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
#include "lldb/lldb-types.h"
|
|
|
|
|
2022-09-12 15:39:57 +00:00
|
|
|
#include "SBBreakpointOptionCommon.h"
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2022-01-19 11:38:26 -08:00
|
|
|
SBBreakpointLocation::SBBreakpointLocation() { LLDB_INSTRUMENT_VA(this); }
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2010-11-05 23:17:00 +00:00
|
|
|
SBBreakpointLocation::SBBreakpointLocation(
|
|
|
|
const lldb::BreakpointLocationSP &break_loc_sp)
|
2017-03-01 10:08:48 +00:00
|
|
|
: m_opaque_wp(break_loc_sp) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, break_loc_sp);
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpointLocation::SBBreakpointLocation(const SBBreakpointLocation &rhs)
|
2019-03-06 00:06:00 +00:00
|
|
|
: m_opaque_wp(rhs.m_opaque_wp) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 00:06:00 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2010-11-05 23:17:00 +00:00
|
|
|
const SBBreakpointLocation &SBBreakpointLocation::
|
|
|
|
operator=(const SBBreakpointLocation &rhs) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2022-01-09 22:54:08 -08:00
|
|
|
return *this;
|
2010-11-05 23:17:00 +00:00
|
|
|
}
|
|
|
|
|
2020-02-17 22:57:06 -08:00
|
|
|
SBBreakpointLocation::~SBBreakpointLocation() = default;
|
2010-11-05 23:17:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP SBBreakpointLocation::GetSP() const {
|
|
|
|
return m_opaque_wp.lock();
|
|
|
|
}
|
|
|
|
|
2019-03-06 00:06:00 +00:00
|
|
|
bool SBBreakpointLocation::IsValid() const {
|
2022-01-19 11: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 13:58:46 +00:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBBreakpointLocation::operator bool() const {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
|
|
|
return bool(GetSP());
|
|
|
|
}
|
2010-11-05 23:17:00 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
SBAddress SBBreakpointLocation::GetAddress() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2019-03-06 00:06:00 +00:00
|
|
|
if (loc_sp) {
|
2022-01-09 22:54:08 -08:00
|
|
|
return SBAddress(loc_sp->GetAddress());
|
2019-03-06 00:06:00 +00:00
|
|
|
}
|
|
|
|
|
2022-01-09 22:54:08 -08:00
|
|
|
return SBAddress();
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
2011-09-24 01:04:57 +00:00
|
|
|
addr_t SBBreakpointLocation::GetLoadAddress() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2011-09-24 01:04:57 +00:00
|
|
|
addr_t ret_addr = LLDB_INVALID_ADDRESS;
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2011-09-24 01:04:57 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
if (loc_sp) {
|
2010-06-08 16:52:24 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
ret_addr = loc_sp->GetLoadAddress();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
return ret_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointLocation::SetEnabled(bool enabled) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, enabled);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetEnabled(enabled);
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::IsEnabled() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsEnabled();
|
2010-06-08 16:52:24 +00:00
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-07-19 14:31:19 +00:00
|
|
|
uint32_t SBBreakpointLocation::GetHitCount() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-07-19 14:31:19 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetHitCount();
|
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
uint32_t SBBreakpointLocation::GetIgnoreCount() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetIgnoreCount();
|
2010-06-08 16:52:24 +00:00
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-09 20:39:50 +00:00
|
|
|
void SBBreakpointLocation::SetIgnoreCount(uint32_t n) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, n);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetIgnoreCount(n);
|
2010-12-20 20:49:23 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 01:15:49 +00:00
|
|
|
void SBBreakpointLocation::SetCondition(const char *condition) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, condition);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetCondition(condition);
|
2010-12-20 20:49:23 +00:00
|
|
|
}
|
2010-10-22 01:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *SBBreakpointLocation::GetCondition() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2023-05-17 10:44:38 -07:00
|
|
|
if (!loc_sp)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return ConstString(loc_sp->GetConditionText()).GetCString();
|
2010-10-22 01:15:49 +00:00
|
|
|
}
|
|
|
|
|
2017-08-03 18:13:24 +00:00
|
|
|
void SBBreakpointLocation::SetAutoContinue(bool auto_continue) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, auto_continue);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-08-03 18:13:24 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetAutoContinue(auto_continue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::GetAutoContinue() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-08-03 18:13:24 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsAutoContinue();
|
|
|
|
}
|
2017-08-03 19:38:38 +00:00
|
|
|
return false;
|
2017-08-03 18:13:24 +00:00
|
|
|
}
|
|
|
|
|
2022-09-12 15:39:57 +00:00
|
|
|
void SBBreakpointLocation::SetCallback(SBBreakpointHitCallback callback,
|
|
|
|
void *baton) {
|
|
|
|
LLDB_INSTRUMENT_VA(this, callback, baton);
|
|
|
|
|
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
|
|
|
|
if (loc_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
|
|
|
|
loc_sp->SetCallback(SBBreakpointCallbackBaton::PrivateBreakpointHitCallback,
|
|
|
|
baton_sp, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 01:04:55 +00:00
|
|
|
void SBBreakpointLocation::SetScriptCallbackFunction(
|
2019-10-25 14:05:07 -07:00
|
|
|
const char *callback_function_name) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, callback_function_name);
|
2019-10-25 14:05:07 -07:00
|
|
|
}
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2019-10-25 14:05:07 -07:00
|
|
|
SBError SBBreakpointLocation::SetScriptCallbackFunction(
|
|
|
|
const char *callback_function_name,
|
|
|
|
SBStructuredData &extra_args) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, callback_function_name, extra_args);
|
2019-10-25 14:05:07 -07:00
|
|
|
SBError sb_error;
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
if (loc_sp) {
|
2019-10-25 14:05:07 -07:00
|
|
|
Status error;
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
2021-06-11 17:00:46 -07:00
|
|
|
BreakpointOptions &bp_options = loc_sp->GetLocationOptions();
|
2019-10-25 14:05:07 -07:00
|
|
|
error = loc_sp->GetBreakpoint()
|
2014-04-02 01:04:55 +00:00
|
|
|
.GetTarget()
|
|
|
|
.GetDebugger()
|
|
|
|
.GetScriptInterpreter()
|
|
|
|
->SetBreakpointCommandCallbackFunction(bp_options,
|
2019-10-25 14:05:07 -07:00
|
|
|
callback_function_name,
|
|
|
|
extra_args.m_impl_up
|
|
|
|
->GetObjectSP());
|
|
|
|
sb_error.SetError(error);
|
|
|
|
} else
|
|
|
|
sb_error.SetErrorString("invalid breakpoint");
|
2020-09-25 11:15:44 -07:00
|
|
|
|
2022-01-09 22:54:08 -08:00
|
|
|
return sb_error;
|
2014-04-02 01:04:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SBError
|
|
|
|
SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, callback_body_text);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2014-04-02 01:04:55 +00:00
|
|
|
SBError sb_error;
|
2017-03-01 10:08:48 +00:00
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
2021-06-11 17:00:46 -07:00
|
|
|
BreakpointOptions &bp_options = loc_sp->GetLocationOptions();
|
2017-05-12 04:51:55 +00:00
|
|
|
Status error =
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetBreakpoint()
|
2014-04-02 01:04:55 +00:00
|
|
|
.GetTarget()
|
|
|
|
.GetDebugger()
|
|
|
|
.GetScriptInterpreter()
|
[lldb] Fix {break,watch}point command function stopping behaviour
In order to run a {break,watch}point command, lldb can resolve to the
script interpreter to run an arbitrary piece of code or call into a
user-provided function. To do so, we will generate a wrapping function,
where we first copy lldb's internal dictionary keys into the
interpreter's global dictionary, copied inline the user code before
resetting the global dictionary to its previous state.
However, {break,watch}point commands can optionally return a value that
would tell lldb whether we should stop or not. This feature was
only implemented for breakpoint commands and since we inlined the user
code directly into the wrapping function, introducing an early return,
that caused lldb to let the interpreter global dictionary tinted with the
internal dictionary keys.
This patch fixes that issue while also adding the stopping behaviour to
watchpoint commands.
To do so, this patch refactors the {break,watch}point command creation
method, to let the lldb wrapper function generator know if the user code is
a function call or a arbitrary expression.
Then the wrapper generator, if the user input was a function call, the
wrapper function will call the user function and save the return value into
a variable. If the user input was an arbitrary expression, the wrapper will
inline it into a nested function, call the nested function and save the
return value into the same variable. After resetting the interpreter global
dictionary to its previous state, the generated wrapper function will return
the varible containing the return value.
rdar://105461140
Differential Revision: https://reviews.llvm.org/D144688
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-02-28 09:24:46 -08:00
|
|
|
->SetBreakpointCommandCallback(bp_options, callback_body_text,
|
|
|
|
/*is_callback=*/false);
|
2014-04-02 01:04:55 +00:00
|
|
|
sb_error.SetError(error);
|
|
|
|
} else
|
|
|
|
sb_error.SetErrorString("invalid breakpoint");
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2022-01-09 22:54:08 -08:00
|
|
|
return sb_error;
|
2014-04-02 01:04:55 +00:00
|
|
|
}
|
|
|
|
|
2017-08-02 00:16:10 +00:00
|
|
|
void SBBreakpointLocation::SetCommandLineCommands(SBStringList &commands) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, commands);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-08-02 00:16:10 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (!loc_sp)
|
|
|
|
return;
|
|
|
|
if (commands.GetSize() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
|
|
|
|
new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
|
|
|
|
|
2021-06-11 17:00:46 -07:00
|
|
|
loc_sp->GetLocationOptions().SetCommandDataCallback(cmd_data_up);
|
2017-08-02 00:16:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::GetCommandLineCommands(SBStringList &commands) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, commands);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-08-02 00:16:10 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (!loc_sp)
|
|
|
|
return false;
|
|
|
|
StringList command_list;
|
|
|
|
bool has_commands =
|
2021-06-11 17:00:46 -07:00
|
|
|
loc_sp->GetLocationOptions().GetCommandLineCallbacks(command_list);
|
2017-08-02 00:16:10 +00:00
|
|
|
if (has_commands)
|
|
|
|
commands.AppendList(command_list);
|
|
|
|
return has_commands;
|
|
|
|
}
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
void SBBreakpointLocation::SetThreadID(tid_t thread_id) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, thread_id);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadID(thread_id);
|
2010-12-20 20:49:23 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tid_t SBBreakpointLocation::GetThreadID() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2010-12-20 20:49:23 +00:00
|
|
|
tid_t tid = LLDB_INVALID_THREAD_ID;
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadID();
|
2010-12-20 20:49:23 +00:00
|
|
|
}
|
|
|
|
return tid;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 01:47:08 +00:00
|
|
|
void SBBreakpointLocation::SetThreadIndex(uint32_t index) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, index);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadIndex(index);
|
2010-12-20 20:49:23 +00:00
|
|
|
}
|
2010-06-18 01:47:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t SBBreakpointLocation::GetThreadIndex() const {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2010-12-20 20:49:23 +00:00
|
|
|
uint32_t thread_idx = UINT32_MAX;
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadIndex();
|
2010-06-18 01:47:08 +00:00
|
|
|
}
|
2010-12-20 20:49:23 +00:00
|
|
|
return thread_idx;
|
2010-06-18 01:47:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointLocation::SetThreadName(const char *thread_name) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, thread_name);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadName(thread_name);
|
2010-06-18 01:47:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *SBBreakpointLocation::GetThreadName() const {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2023-05-17 10:44:38 -07:00
|
|
|
if (!loc_sp)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return ConstString(loc_sp->GetThreadName()).GetCString();
|
2010-06-18 01:47:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointLocation::SetQueueName(const char *queue_name) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, queue_name);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetQueueName(queue_name);
|
2010-06-18 01:47:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
const char *SBBreakpointLocation::GetQueueName() const {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2023-05-17 10:44:38 -07:00
|
|
|
if (!loc_sp)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return ConstString(loc_sp->GetQueueName()).GetCString();
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::IsResolved() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2010-06-08 16:52:24 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsResolved();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
return false;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
2011-04-25 20:23:05 +00:00
|
|
|
void SBBreakpointLocation::SetLocation(
|
|
|
|
const lldb::BreakpointLocationSP &break_loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
// Uninstall the callbacks?
|
2017-03-01 10:08:48 +00:00
|
|
|
m_opaque_wp = break_loc_sp;
|
2010-09-20 05:20:02 +00:00
|
|
|
}
|
|
|
|
|
2012-05-16 00:51:15 +00:00
|
|
|
bool SBBreakpointLocation::GetDescription(SBStream &description,
|
|
|
|
DescriptionLevel level) {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this, description, level);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2011-11-13 06:57:31 +00:00
|
|
|
Stream &strm = description.ref();
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->GetDescription(&strm, level);
|
2012-05-16 00:51:15 +00:00
|
|
|
strm.EOL();
|
|
|
|
} else
|
|
|
|
strm.PutCString("No value");
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2012-05-16 00:51:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
break_id_t SBBreakpointLocation::GetID() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetID();
|
2010-10-26 03:11:13 +00:00
|
|
|
} else
|
2010-06-08 16:52:24 +00:00
|
|
|
return LLDB_INVALID_BREAK_ID;
|
|
|
|
}
|
|
|
|
|
2014-04-04 04:06:10 +00:00
|
|
|
SBBreakpoint SBBreakpointLocation::GetBreakpoint() {
|
2022-01-19 11:38:26 -08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 00:06:00 +00:00
|
|
|
|
2017-03-01 10:08:48 +00:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
SBBreakpoint sb_bp;
|
2017-03-01 10:08:48 +00:00
|
|
|
if (loc_sp) {
|
2016-05-19 05:13:57 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 10:08:48 +00:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
sb_bp = loc_sp->GetBreakpoint().shared_from_this();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
2022-01-09 22:54:08 -08:00
|
|
|
return sb_bp;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|