[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
|
|
|
//===-- SBWatchpoint.cpp --------------------------------------------------===//
|
2011-09-27 06:40:50 +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
|
2011-09-27 06:40:50 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
#include "lldb/API/SBWatchpoint.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
#include "lldb/API/SBAddress.h"
|
|
|
|
#include "lldb/API/SBDebugger.h"
|
|
|
|
#include "lldb/API/SBDefines.h"
|
2012-12-18 10:03:49 +08:00
|
|
|
#include "lldb/API/SBEvent.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2022-01-20 03:38:26 +08:00
|
|
|
#include "lldb/Utility/Instrumentation.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2011-10-14 08:42:25 +08:00
|
|
|
#include "lldb/Breakpoint/Watchpoint.h"
|
|
|
|
#include "lldb/Breakpoint/WatchpointList.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
#include "lldb/Core/StreamFile.h"
|
2016-11-02 04:37:02 +08:00
|
|
|
#include "lldb/Target/Process.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
#include "lldb/lldb-types.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2022-01-20 03:38:26 +08:00
|
|
|
SBWatchpoint::SBWatchpoint() { LLDB_INSTRUMENT_VA(this); }
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
SBWatchpoint::SBWatchpoint(const lldb::WatchpointSP &wp_sp)
|
2017-02-28 20:32:45 +08:00
|
|
|
: m_opaque_wp(wp_sp) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, wp_sp);
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
SBWatchpoint::SBWatchpoint(const SBWatchpoint &rhs)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_wp(rhs.m_opaque_wp) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
const SBWatchpoint &SBWatchpoint::operator=(const SBWatchpoint &rhs) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-02-28 20:32:45 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2022-01-10 14:54:08 +08:00
|
|
|
return *this;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2020-02-18 14:57:06 +08:00
|
|
|
SBWatchpoint::~SBWatchpoint() = default;
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
watch_id_t SBWatchpoint::GetID() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
watch_id_t watch_id = LLDB_INVALID_WATCH_ID;
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp)
|
|
|
|
watch_id = watchpoint_sp->GetID();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-08-11 08:35:26 +08:00
|
|
|
return watch_id;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBWatchpoint::IsValid() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBWatchpoint::operator bool() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
|
|
|
return bool(m_opaque_wp.lock());
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Make operator==s consistent between c++ and python APIs
Summary:
modify-python-lldb.py had code to insert python equality operators to
some classes. Some of those classes already had c++ equality operators,
and some didn't.
This makes the situation more consistent, by removing all equality
handilng from modify-python-lldb. Instead, I add c++ operators to
classes where they were missing, and expose them in the swig interface
files so that they are available to python too.
The only tricky case was the SBAddress class, which had an operator==
defined as a free function, which is not handled by swig. This function
cannot be removed without breaking ABI, and we cannot add an extra
operator== member, as that would make equality comparisons ambiguous.
For this class, I define a python __eq__ function by hand and have it
delegate to the operator!=, which I have defined as a member function.
This isn't fully NFC, as the semantics of some equality functions in
python changes slightly, but I believe it changes for the better (e.g.,
previously SBBreakpoint.__eq__ would consider two breakpoints with the
same ID as equal, even if they belonged to different targets; now they
are only equal if they belong to the same target).
Reviewers: jingham, clayborg, zturner
Subscribers: jdoerfert, JDevlieghere, lldb-commits
Differential Revision: https://reviews.llvm.org/D59819
llvm-svn: 357463
2019-04-02 18:18:46 +08:00
|
|
|
bool SBWatchpoint::operator==(const SBWatchpoint &rhs) const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
Make operator==s consistent between c++ and python APIs
Summary:
modify-python-lldb.py had code to insert python equality operators to
some classes. Some of those classes already had c++ equality operators,
and some didn't.
This makes the situation more consistent, by removing all equality
handilng from modify-python-lldb. Instead, I add c++ operators to
classes where they were missing, and expose them in the swig interface
files so that they are available to python too.
The only tricky case was the SBAddress class, which had an operator==
defined as a free function, which is not handled by swig. This function
cannot be removed without breaking ABI, and we cannot add an extra
operator== member, as that would make equality comparisons ambiguous.
For this class, I define a python __eq__ function by hand and have it
delegate to the operator!=, which I have defined as a member function.
This isn't fully NFC, as the semantics of some equality functions in
python changes slightly, but I believe it changes for the better (e.g.,
previously SBBreakpoint.__eq__ would consider two breakpoints with the
same ID as equal, even if they belonged to different targets; now they
are only equal if they belong to the same target).
Reviewers: jingham, clayborg, zturner
Subscribers: jdoerfert, JDevlieghere, lldb-commits
Differential Revision: https://reviews.llvm.org/D59819
llvm-svn: 357463
2019-04-02 18:18:46 +08:00
|
|
|
|
|
|
|
return GetSP() == rhs.GetSP();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBWatchpoint::operator!=(const SBWatchpoint &rhs) const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
Make operator==s consistent between c++ and python APIs
Summary:
modify-python-lldb.py had code to insert python equality operators to
some classes. Some of those classes already had c++ equality operators,
and some didn't.
This makes the situation more consistent, by removing all equality
handilng from modify-python-lldb. Instead, I add c++ operators to
classes where they were missing, and expose them in the swig interface
files so that they are available to python too.
The only tricky case was the SBAddress class, which had an operator==
defined as a free function, which is not handled by swig. This function
cannot be removed without breaking ABI, and we cannot add an extra
operator== member, as that would make equality comparisons ambiguous.
For this class, I define a python __eq__ function by hand and have it
delegate to the operator!=, which I have defined as a member function.
This isn't fully NFC, as the semantics of some equality functions in
python changes slightly, but I believe it changes for the better (e.g.,
previously SBBreakpoint.__eq__ would consider two breakpoints with the
same ID as equal, even if they belonged to different targets; now they
are only equal if they belong to the same target).
Reviewers: jingham, clayborg, zturner
Subscribers: jdoerfert, JDevlieghere, lldb-commits
Differential Revision: https://reviews.llvm.org/D59819
llvm-svn: 357463
2019-04-02 18:18:46 +08:00
|
|
|
|
|
|
|
return !(*this == rhs);
|
|
|
|
}
|
|
|
|
|
2012-06-07 02:46:25 +08:00
|
|
|
SBError SBWatchpoint::GetError() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-06-07 02:46:25 +08:00
|
|
|
SBError sb_error;
|
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
sb_error.SetError(watchpoint_sp->GetError());
|
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return sb_error;
|
2012-06-07 02:46:25 +08:00
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
int32_t SBWatchpoint::GetHardwareIndex() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
int32_t hw_index = -1;
|
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
hw_index = watchpoint_sp->GetHardwareIndex();
|
2011-09-27 09:19:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return hw_index;
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
addr_t SBWatchpoint::GetWatchAddress() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2011-09-27 06:40:50 +08:00
|
|
|
addr_t ret_addr = LLDB_INVALID_ADDRESS;
|
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
ret_addr = watchpoint_sp->GetLoadAddress();
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret_addr;
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
size_t SBWatchpoint::GetWatchSize() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2011-09-27 06:40:50 +08:00
|
|
|
size_t watch_size = 0;
|
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
watch_size = watchpoint_sp->GetByteSize();
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return watch_size;
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
void SBWatchpoint::SetEnabled(bool enabled) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, enabled);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-11-02 04:37:02 +08:00
|
|
|
Target &target = watchpoint_sp->GetTarget();
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex());
|
|
|
|
ProcessSP process_sp = target.GetProcessSP();
|
2016-11-02 09:06:42 +08:00
|
|
|
const bool notify = true;
|
2016-11-02 04:37:02 +08:00
|
|
|
if (process_sp) {
|
|
|
|
if (enabled)
|
2016-11-02 09:06:42 +08:00
|
|
|
process_sp->EnableWatchpoint(watchpoint_sp.get(), notify);
|
2016-11-02 04:37:02 +08:00
|
|
|
else
|
2016-11-02 09:06:42 +08:00
|
|
|
process_sp->DisableWatchpoint(watchpoint_sp.get(), notify);
|
2016-11-02 04:37:02 +08:00
|
|
|
} else {
|
2016-11-02 09:06:42 +08:00
|
|
|
watchpoint_sp->SetEnabled(enabled, notify);
|
2016-11-02 04:37:02 +08:00
|
|
|
}
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
bool SBWatchpoint::IsEnabled() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
return watchpoint_sp->IsEnabled();
|
2011-09-27 06:40:50 +08:00
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
uint32_t SBWatchpoint::GetHitCount() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
uint32_t count = 0;
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
count = watchpoint_sp->GetHitCount();
|
2011-09-27 09:19:20 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
uint32_t SBWatchpoint::GetIgnoreCount() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
return watchpoint_sp->GetIgnoreCount();
|
2011-09-27 06:40:50 +08:00
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
void SBWatchpoint::SetIgnoreCount(uint32_t n) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, n);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
watchpoint_sp->SetIgnoreCount(n);
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-18 02:58:00 +08:00
|
|
|
const char *SBWatchpoint::GetCondition() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
return watchpoint_sp->GetConditionText();
|
2011-10-18 02:58:00 +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;
|
2011-10-18 02:58:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBWatchpoint::SetCondition(const char *condition) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, condition);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2012-02-04 10:27:34 +08:00
|
|
|
watchpoint_sp->SetCondition(condition);
|
2011-10-18 02:58:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
bool SBWatchpoint::GetDescription(SBStream &description,
|
|
|
|
DescriptionLevel level) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, description, level);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
2011-09-27 06:40:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2016-05-19 13:13:57 +08:00
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
2011-09-27 06:40:50 +08:00
|
|
|
watchpoint_sp->GetDescription(&strm, level);
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.EOL();
|
2011-09-27 06:40:50 +08:00
|
|
|
} else
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.PutCString("No value");
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
return true;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
void SBWatchpoint::Clear() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
m_opaque_wp.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::WatchpointSP SBWatchpoint::GetSP() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2012-12-18 10:03:49 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return m_opaque_wp.lock();
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBWatchpoint::SetSP(const lldb::WatchpointSP &sp) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sp);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
|
|
|
m_opaque_wp = sp;
|
|
|
|
}
|
2012-12-18 10:03:49 +08:00
|
|
|
|
|
|
|
bool SBWatchpoint::EventIsWatchpointEvent(const lldb::SBEvent &event) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-12-18 10:03:49 +08:00
|
|
|
return Watchpoint::WatchpointEventData::GetEventDataFromEvent(event.get()) !=
|
[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
|
|
|
nullptr;
|
2012-12-18 10:03:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
WatchpointEventType
|
|
|
|
SBWatchpoint::GetWatchpointEventTypeFromEvent(const SBEvent &event) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-12-18 10:03:49 +08:00
|
|
|
if (event.IsValid())
|
|
|
|
return Watchpoint::WatchpointEventData::GetWatchpointEventTypeFromEvent(
|
|
|
|
event.GetSP());
|
|
|
|
return eWatchpointEventTypeInvalidType;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-12-18 10:03:49 +08:00
|
|
|
SBWatchpoint SBWatchpoint::GetWatchpointFromEvent(const lldb::SBEvent &event) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(event);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2012-12-18 10:03:49 +08:00
|
|
|
SBWatchpoint sb_watchpoint;
|
|
|
|
if (event.IsValid())
|
2017-02-28 20:32:45 +08:00
|
|
|
sb_watchpoint =
|
2012-12-18 10:03:49 +08:00
|
|
|
Watchpoint::WatchpointEventData::GetWatchpointFromEvent(event.GetSP());
|
2022-01-10 14:54:08 +08:00
|
|
|
return sb_watchpoint;
|
2012-12-18 10:03:49 +08:00
|
|
|
}
|