2011-10-14 02:08:26 +08:00
|
|
|
//===-- SBWatchpoint.cpp --------------------------------*- C++ -*-===//
|
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"
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
#include "lldb/API/SBAddress.h"
|
|
|
|
#include "lldb/API/SBDebugger.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#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"
|
|
|
|
|
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"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
#include "lldb/lldb-types.h"
|
2011-09-27 06:40:50 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBWatchpoint::SBWatchpoint() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBWatchpoint); }
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBWatchpoint::SBWatchpoint(const lldb::WatchpointSP &wp_sp)
|
2017-02-28 20:32:45 +08:00
|
|
|
: m_opaque_wp(wp_sp) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBWatchpoint, (const lldb::WatchpointSP &), wp_sp);
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBWatchpoint::SBWatchpoint(const SBWatchpoint &rhs)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_wp(rhs.m_opaque_wp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBWatchpoint, (const lldb::SBWatchpoint &), rhs);
|
|
|
|
}
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const SBWatchpoint &SBWatchpoint::operator=(const SBWatchpoint &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(const lldb::SBWatchpoint &,
|
|
|
|
SBWatchpoint, operator=,(const lldb::SBWatchpoint &), rhs);
|
|
|
|
|
2017-02-28 20:32:45 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBWatchpoint::~SBWatchpoint() {}
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
watch_id_t SBWatchpoint::GetID() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::watch_id_t, SBWatchpoint, GetID);
|
|
|
|
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
watch_id_t watch_id = LLDB_INVALID_WATCH_ID;
|
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp)
|
|
|
|
watch_id = watchpoint_sp->GetID();
|
|
|
|
|
|
|
|
return watch_id;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBWatchpoint::IsValid() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBWatchpoint, 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();
|
|
|
|
}
|
|
|
|
SBWatchpoint::operator bool() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBWatchpoint, operator bool);
|
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 {
|
|
|
|
LLDB_RECORD_METHOD_CONST(
|
|
|
|
bool, SBWatchpoint, operator==,(const SBWatchpoint &), rhs);
|
|
|
|
|
|
|
|
return GetSP() == rhs.GetSP();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBWatchpoint::operator!=(const SBWatchpoint &rhs) const {
|
|
|
|
LLDB_RECORD_METHOD_CONST(
|
|
|
|
bool, SBWatchpoint, operator!=,(const SBWatchpoint &), rhs);
|
|
|
|
|
|
|
|
return !(*this == rhs);
|
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBError SBWatchpoint::GetError() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBError, SBWatchpoint, GetError);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBError sb_error;
|
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
sb_error.SetError(watchpoint_sp->GetError());
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_error);
|
2012-06-07 02:46:25 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
int32_t SBWatchpoint::GetHardwareIndex() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(int32_t, SBWatchpoint, GetHardwareIndex);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
int32_t hw_index = -1;
|
2011-09-27 09:19:20 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
hw_index = watchpoint_sp->GetHardwareIndex();
|
|
|
|
}
|
2011-09-27 09:19:20 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return hw_index;
|
2011-09-27 09:19:20 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
addr_t SBWatchpoint::GetWatchAddress() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBWatchpoint, GetWatchAddress);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
addr_t ret_addr = LLDB_INVALID_ADDRESS;
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
ret_addr = watchpoint_sp->GetLoadAddress();
|
|
|
|
}
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return ret_addr;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t SBWatchpoint::GetWatchSize() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(size_t, SBWatchpoint, GetWatchSize);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t watch_size = 0;
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
watch_size = watchpoint_sp->GetByteSize();
|
|
|
|
}
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return watch_size;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBWatchpoint::SetEnabled(bool enabled) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBWatchpoint, SetEnabled, (bool), enabled);
|
|
|
|
|
2016-09-07 04:57:50 +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
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBWatchpoint::IsEnabled() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBWatchpoint, IsEnabled);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
return watchpoint_sp->IsEnabled();
|
|
|
|
} else
|
|
|
|
return false;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBWatchpoint::GetHitCount() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBWatchpoint, GetHitCount);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t count = 0;
|
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
count = watchpoint_sp->GetHitCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
2011-09-27 09:19:20 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBWatchpoint::GetIgnoreCount() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBWatchpoint, GetIgnoreCount);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
return watchpoint_sp->GetIgnoreCount();
|
|
|
|
} else
|
|
|
|
return 0;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBWatchpoint::SetIgnoreCount(uint32_t n) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBWatchpoint, SetIgnoreCount, (uint32_t), n);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
watchpoint_sp->SetIgnoreCount(n);
|
|
|
|
}
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *SBWatchpoint::GetCondition() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBWatchpoint, GetCondition);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
return watchpoint_sp->GetConditionText();
|
|
|
|
}
|
|
|
|
return NULL;
|
2011-10-18 02:58:00 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBWatchpoint::SetCondition(const char *condition) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBWatchpoint, SetCondition, (const char *),
|
|
|
|
condition);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
watchpoint_sp->SetCondition(condition);
|
|
|
|
}
|
2011-10-18 02:58:00 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBWatchpoint::GetDescription(SBStream &description,
|
|
|
|
DescriptionLevel level) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBWatchpoint, GetDescription,
|
|
|
|
(lldb::SBStream &, lldb::DescriptionLevel), description,
|
|
|
|
level);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
Stream &strm = description.ref();
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::WatchpointSP watchpoint_sp(GetSP());
|
|
|
|
if (watchpoint_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
watchpoint_sp->GetTarget().GetAPIMutex());
|
|
|
|
watchpoint_sp->GetDescription(&strm, level);
|
|
|
|
strm.EOL();
|
|
|
|
} else
|
|
|
|
strm.PutCString("No value");
|
2011-09-27 06:40:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return true;
|
2011-09-27 06:40:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
void SBWatchpoint::Clear() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBWatchpoint, Clear);
|
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 {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::WatchpointSP, SBWatchpoint, GetSP);
|
2012-12-18 10:03:49 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(m_opaque_wp.lock());
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBWatchpoint::SetSP(const lldb::WatchpointSP &sp) {
|
|
|
|
LLDB_RECORD_METHOD(void, SBWatchpoint, SetSP, (const lldb::WatchpointSP &),
|
|
|
|
sp);
|
|
|
|
|
|
|
|
m_opaque_wp = sp;
|
|
|
|
}
|
2012-12-18 10:03:49 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBWatchpoint::EventIsWatchpointEvent(const lldb::SBEvent &event) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(bool, SBWatchpoint, EventIsWatchpointEvent,
|
|
|
|
(const lldb::SBEvent &), event);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return Watchpoint::WatchpointEventData::GetEventDataFromEvent(event.get()) !=
|
|
|
|
NULL;
|
2012-12-18 10:03:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
WatchpointEventType
|
2016-09-07 04:57:50 +08:00
|
|
|
SBWatchpoint::GetWatchpointEventTypeFromEvent(const SBEvent &event) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(lldb::WatchpointEventType, SBWatchpoint,
|
|
|
|
GetWatchpointEventTypeFromEvent,
|
|
|
|
(const lldb::SBEvent &), event);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (event.IsValid())
|
|
|
|
return Watchpoint::WatchpointEventData::GetWatchpointEventTypeFromEvent(
|
|
|
|
event.GetSP());
|
|
|
|
return eWatchpointEventTypeInvalidType;
|
|
|
|
}
|
|
|
|
|
|
|
|
SBWatchpoint SBWatchpoint::GetWatchpointFromEvent(const lldb::SBEvent &event) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_STATIC_METHOD(lldb::SBWatchpoint, SBWatchpoint,
|
|
|
|
GetWatchpointFromEvent, (const lldb::SBEvent &),
|
|
|
|
event);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBWatchpoint sb_watchpoint;
|
|
|
|
if (event.IsValid())
|
2017-02-28 20:32:45 +08:00
|
|
|
sb_watchpoint =
|
2016-09-07 04:57:50 +08:00
|
|
|
Watchpoint::WatchpointEventData::GetWatchpointFromEvent(event.GetSP());
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_watchpoint);
|
2012-12-18 10:03:49 +08:00
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBWatchpoint>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBWatchpoint, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBWatchpoint, (const lldb::WatchpointSP &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBWatchpoint, (const lldb::SBWatchpoint &));
|
|
|
|
LLDB_REGISTER_METHOD(const lldb::SBWatchpoint &,
|
|
|
|
SBWatchpoint, operator=,(const lldb::SBWatchpoint &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::watch_id_t, SBWatchpoint, GetID, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBWatchpoint, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBWatchpoint, operator bool, ());
|
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
|
|
|
LLDB_REGISTER_METHOD_CONST(
|
|
|
|
bool, SBWatchpoint, operator==,(const lldb::SBWatchpoint &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(
|
|
|
|
bool, SBWatchpoint, operator!=,(const lldb::SBWatchpoint &));
|
2019-03-20 01:13:13 +08:00
|
|
|
LLDB_REGISTER_METHOD(lldb::SBError, SBWatchpoint, GetError, ());
|
|
|
|
LLDB_REGISTER_METHOD(int32_t, SBWatchpoint, GetHardwareIndex, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::addr_t, SBWatchpoint, GetWatchAddress, ());
|
|
|
|
LLDB_REGISTER_METHOD(size_t, SBWatchpoint, GetWatchSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBWatchpoint, SetEnabled, (bool));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBWatchpoint, IsEnabled, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBWatchpoint, GetHitCount, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBWatchpoint, GetIgnoreCount, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBWatchpoint, SetIgnoreCount, (uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(const char *, SBWatchpoint, GetCondition, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBWatchpoint, SetCondition, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBWatchpoint, GetDescription,
|
|
|
|
(lldb::SBStream &, lldb::DescriptionLevel));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBWatchpoint, Clear, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::WatchpointSP, SBWatchpoint, GetSP, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBWatchpoint, SetSP,
|
|
|
|
(const lldb::WatchpointSP &));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(bool, SBWatchpoint, EventIsWatchpointEvent,
|
|
|
|
(const lldb::SBEvent &));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(lldb::WatchpointEventType, SBWatchpoint,
|
|
|
|
GetWatchpointEventTypeFromEvent,
|
|
|
|
(const lldb::SBEvent &));
|
|
|
|
LLDB_REGISTER_STATIC_METHOD(lldb::SBWatchpoint, SBWatchpoint,
|
|
|
|
GetWatchpointFromEvent,
|
|
|
|
(const lldb::SBEvent &));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|