[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
|
|
|
//===-- SBBreakpointLocation.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/SBBreakpointLocation.h"
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2011-09-24 09:37:21 +08:00
|
|
|
#include "lldb/API/SBAddress.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/API/SBDebugger.h"
|
|
|
|
#include "lldb/API/SBDefines.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2019-10-26 05:05:07 +08:00
|
|
|
#include "lldb/API/SBStructuredData.h"
|
2017-08-02 08:16:10 +08:00
|
|
|
#include "lldb/API/SBStringList.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-11-19 02:52:36 +08:00
|
|
|
#include "lldb/Breakpoint/Breakpoint.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.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-12-21 04:49:23 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-18 09:47:08 +08:00
|
|
|
#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
|
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
#include "lldb/lldb-types.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBBreakpointLocation::SBBreakpointLocation() {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBreakpointLocation);
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
SBBreakpointLocation::SBBreakpointLocation(
|
|
|
|
const lldb::BreakpointLocationSP &break_loc_sp)
|
2017-03-01 18:08:48 +08:00
|
|
|
: m_opaque_wp(break_loc_sp) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBBreakpointLocation,
|
|
|
|
(const lldb::BreakpointLocationSP &), break_loc_sp);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpointLocation::SBBreakpointLocation(const SBBreakpointLocation &rhs)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_wp(rhs.m_opaque_wp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBBreakpointLocation,
|
|
|
|
(const lldb::SBBreakpointLocation &), rhs);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
const SBBreakpointLocation &SBBreakpointLocation::
|
|
|
|
operator=(const SBBreakpointLocation &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(
|
|
|
|
const lldb::SBBreakpointLocation &,
|
|
|
|
SBBreakpointLocation, operator=,(const lldb::SBBreakpointLocation &),
|
|
|
|
rhs);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2010-11-06 07:17:00 +08:00
|
|
|
}
|
|
|
|
|
2020-02-18 14:57:06 +08:00
|
|
|
SBBreakpointLocation::~SBBreakpointLocation() = default;
|
2010-11-06 07:17:00 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP SBBreakpointLocation::GetSP() const {
|
|
|
|
return m_opaque_wp.lock();
|
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBBreakpointLocation::IsValid() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpointLocation, 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();
|
|
|
|
}
|
|
|
|
SBBreakpointLocation::operator bool() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpointLocation, operator bool);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
|
|
|
return bool(GetSP());
|
|
|
|
}
|
2010-11-06 07:17:00 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBAddress SBBreakpointLocation::GetAddress() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBAddress, SBBreakpointLocation, GetAddress);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2019-03-06 08:06:00 +08:00
|
|
|
if (loc_sp) {
|
|
|
|
return LLDB_RECORD_RESULT(SBAddress(&loc_sp->GetAddress()));
|
|
|
|
}
|
|
|
|
|
|
|
|
return LLDB_RECORD_RESULT(SBAddress());
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-09-24 09:04:57 +08:00
|
|
|
addr_t SBBreakpointLocation::GetLoadAddress() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBBreakpointLocation,
|
|
|
|
GetLoadAddress);
|
|
|
|
|
2011-09-24 09:04:57 +08:00
|
|
|
addr_t ret_addr = LLDB_INVALID_ADDRESS;
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2011-09-24 09:04:57 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2010-06-09 00:52:24 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
ret_addr = loc_sp->GetLoadAddress();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
return ret_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointLocation::SetEnabled(bool enabled) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetEnabled, (bool), enabled);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetEnabled(enabled);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::IsEnabled() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpointLocation, IsEnabled);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsEnabled();
|
2010-06-09 00:52:24 +08:00
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-07-19 22:31:19 +08:00
|
|
|
uint32_t SBBreakpointLocation::GetHitCount() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBBreakpointLocation, GetHitCount);
|
|
|
|
|
2017-07-19 22:31:19 +08: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-09 00:52:24 +08:00
|
|
|
uint32_t SBBreakpointLocation::GetIgnoreCount() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBBreakpointLocation, GetIgnoreCount);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetIgnoreCount();
|
2010-06-09 00:52:24 +08:00
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
void SBBreakpointLocation::SetIgnoreCount(uint32_t n) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetIgnoreCount, (uint32_t), n);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetIgnoreCount(n);
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-22 09:15:49 +08:00
|
|
|
void SBBreakpointLocation::SetCondition(const char *condition) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetCondition, (const char *),
|
|
|
|
condition);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetCondition(condition);
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-10-22 09:15:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *SBBreakpointLocation::GetCondition() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBBreakpointLocation, GetCondition);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetConditionText();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 19:14:47 +08:00
|
|
|
return nullptr;
|
2010-10-22 09:15:49 +08:00
|
|
|
}
|
|
|
|
|
2017-08-04 02:13:24 +08:00
|
|
|
void SBBreakpointLocation::SetAutoContinue(bool auto_continue) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetAutoContinue, (bool),
|
|
|
|
auto_continue);
|
|
|
|
|
2017-08-04 02:13:24 +08: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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpointLocation, GetAutoContinue);
|
|
|
|
|
2017-08-04 02:13:24 +08: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-04 03:38:38 +08:00
|
|
|
return false;
|
2017-08-04 02:13:24 +08:00
|
|
|
}
|
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
void SBBreakpointLocation::SetScriptCallbackFunction(
|
2019-10-26 05:05:07 +08:00
|
|
|
const char *callback_function_name) {
|
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetScriptCallbackFunction,
|
|
|
|
(const char *), callback_function_name);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2019-10-26 05:05:07 +08:00
|
|
|
SBError SBBreakpointLocation::SetScriptCallbackFunction(
|
|
|
|
const char *callback_function_name,
|
|
|
|
SBStructuredData &extra_args) {
|
|
|
|
LLDB_RECORD_METHOD(SBError, SBBreakpointLocation, SetScriptCallbackFunction,
|
|
|
|
(const char *, SBStructuredData &),
|
|
|
|
callback_function_name, extra_args);
|
|
|
|
SBError sb_error;
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_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-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
BreakpointOptions *bp_options = loc_sp->GetLocationOptions();
|
2019-10-26 05:05:07 +08:00
|
|
|
error = loc_sp->GetBreakpoint()
|
2014-04-02 09:04:55 +08:00
|
|
|
.GetTarget()
|
|
|
|
.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);
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBError
|
|
|
|
SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBError, SBBreakpointLocation, SetScriptCallbackBody,
|
|
|
|
(const char *), callback_body_text);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-04-02 09:04:55 +08:00
|
|
|
SBError sb_error;
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
BreakpointOptions *bp_options = loc_sp->GetLocationOptions();
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error =
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetBreakpoint()
|
2014-04-02 09:04:55 +08:00
|
|
|
.GetTarget()
|
|
|
|
.GetDebugger()
|
|
|
|
.GetScriptInterpreter()
|
|
|
|
->SetBreakpointCommandCallback(bp_options, callback_body_text);
|
|
|
|
sb_error.SetError(error);
|
|
|
|
} else
|
|
|
|
sb_error.SetErrorString("invalid breakpoint");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_error);
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
|
|
|
|
2017-08-02 08:16:10 +08:00
|
|
|
void SBBreakpointLocation::SetCommandLineCommands(SBStringList &commands) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &), commands);
|
|
|
|
|
2017-08-02 08:16:10 +08: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));
|
|
|
|
|
|
|
|
loc_sp->GetLocationOptions()->SetCommandDataCallback(cmd_data_up);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::GetCommandLineCommands(SBStringList &commands) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpointLocation, GetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &), commands);
|
|
|
|
|
2017-08-02 08:16:10 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (!loc_sp)
|
|
|
|
return false;
|
|
|
|
StringList command_list;
|
|
|
|
bool has_commands =
|
|
|
|
loc_sp->GetLocationOptions()->GetCommandLineCallbacks(command_list);
|
|
|
|
if (has_commands)
|
|
|
|
commands.AppendList(command_list);
|
|
|
|
return has_commands;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void SBBreakpointLocation::SetThreadID(tid_t thread_id) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetThreadID, (lldb::tid_t),
|
|
|
|
thread_id);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadID(thread_id);
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
tid_t SBBreakpointLocation::GetThreadID() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::tid_t, SBBreakpointLocation, GetThreadID);
|
|
|
|
|
2010-12-21 04:49:23 +08:00
|
|
|
tid_t tid = LLDB_INVALID_THREAD_ID;
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadID();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
|
|
|
return tid;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-06-18 09:47:08 +08:00
|
|
|
void SBBreakpointLocation::SetThreadIndex(uint32_t index) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetThreadIndex, (uint32_t),
|
|
|
|
index);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadIndex(index);
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t SBBreakpointLocation::GetThreadIndex() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpointLocation,
|
|
|
|
GetThreadIndex);
|
|
|
|
|
2010-12-21 04:49:23 +08:00
|
|
|
uint32_t thread_idx = UINT32_MAX;
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadIndex();
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
return thread_idx;
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointLocation::SetThreadName(const char *thread_name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetThreadName, (const char *),
|
|
|
|
thread_name);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadName(thread_name);
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *SBBreakpointLocation::GetThreadName() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpointLocation,
|
|
|
|
GetThreadName);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadName();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 19:14:47 +08:00
|
|
|
return nullptr;
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBBreakpointLocation::SetQueueName(const char *queue_name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBBreakpointLocation, SetQueueName, (const char *),
|
|
|
|
queue_name);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetQueueName(queue_name);
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
const char *SBBreakpointLocation::GetQueueName() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpointLocation,
|
|
|
|
GetQueueName);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->GetQueueName();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 19:14:47 +08:00
|
|
|
return nullptr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::IsResolved() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpointLocation, IsResolved);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2010-06-09 00:52:24 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsResolved();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-04-26 04:23:05 +08:00
|
|
|
void SBBreakpointLocation::SetLocation(
|
|
|
|
const lldb::BreakpointLocationSP &break_loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
// Uninstall the callbacks?
|
2017-03-01 18:08:48 +08:00
|
|
|
m_opaque_wp = break_loc_sp;
|
2010-09-20 13:20:02 +08:00
|
|
|
}
|
|
|
|
|
2012-05-16 08:51:15 +08:00
|
|
|
bool SBBreakpointLocation::GetDescription(SBStream &description,
|
|
|
|
DescriptionLevel level) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBBreakpointLocation, GetDescription,
|
|
|
|
(lldb::SBStream &, lldb::DescriptionLevel), description,
|
|
|
|
level);
|
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->GetDescription(&strm, level);
|
2012-05-16 08:51:15 +08:00
|
|
|
strm.EOL();
|
|
|
|
} else
|
|
|
|
strm.PutCString("No value");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-05-16 08:51:15 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
break_id_t SBBreakpointLocation::GetID() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::break_id_t, SBBreakpointLocation, GetID);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetID();
|
2010-10-26 11:11:13 +08:00
|
|
|
} else
|
2010-06-09 00:52:24 +08:00
|
|
|
return LLDB_INVALID_BREAK_ID;
|
|
|
|
}
|
|
|
|
|
2014-04-04 12:06:10 +08:00
|
|
|
SBBreakpoint SBBreakpointLocation::GetBreakpoint() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBBreakpoint, SBBreakpointLocation,
|
|
|
|
GetBreakpoint);
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBBreakpoint sb_bp;
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
sb_bp = loc_sp->GetBreakpoint().shared_from_this();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_bp);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBBreakpointLocation>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBBreakpointLocation, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBBreakpointLocation,
|
|
|
|
(const lldb::BreakpointLocationSP &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBBreakpointLocation,
|
|
|
|
(const lldb::SBBreakpointLocation &));
|
|
|
|
LLDB_REGISTER_METHOD(
|
|
|
|
const lldb::SBBreakpointLocation &,
|
|
|
|
SBBreakpointLocation, operator=,(const lldb::SBBreakpointLocation &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpointLocation, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpointLocation, operator bool, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBAddress, SBBreakpointLocation, GetAddress, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::addr_t, SBBreakpointLocation, GetLoadAddress,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetEnabled, (bool));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpointLocation, IsEnabled, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBBreakpointLocation, GetHitCount, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBBreakpointLocation, GetIgnoreCount, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetIgnoreCount,
|
|
|
|
(uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetCondition,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD(const char *, SBBreakpointLocation, GetCondition, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetAutoContinue, (bool));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpointLocation, GetAutoContinue, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetScriptCallbackFunction,
|
|
|
|
(const char *));
|
2019-10-26 05:05:07 +08:00
|
|
|
LLDB_REGISTER_METHOD(SBError, SBBreakpointLocation, SetScriptCallbackFunction,
|
|
|
|
(const char *, SBStructuredData &));
|
2019-03-20 01:13:13 +08:00
|
|
|
LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpointLocation,
|
|
|
|
SetScriptCallbackBody, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpointLocation, GetCommandLineCommands,
|
|
|
|
(lldb::SBStringList &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetThreadID,
|
|
|
|
(lldb::tid_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::tid_t, SBBreakpointLocation, GetThreadID, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetThreadIndex,
|
|
|
|
(uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBBreakpointLocation, GetThreadIndex,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetThreadName,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpointLocation,
|
|
|
|
GetThreadName, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBBreakpointLocation, SetQueueName,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const char *, SBBreakpointLocation, GetQueueName,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpointLocation, IsResolved, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBBreakpointLocation, GetDescription,
|
|
|
|
(lldb::SBStream &, lldb::DescriptionLevel));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::break_id_t, SBBreakpointLocation, GetID, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBBreakpointLocation,
|
|
|
|
GetBreakpoint, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|