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
105 lines
2.6 KiB
C++
105 lines
2.6 KiB
C++
//===-- SWIG Interface for SBWatchpoint -----------------*- C++ -*-===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace lldb {
|
|
|
|
%feature("docstring",
|
|
"Represents an instance of watchpoint for a specific target program.
|
|
|
|
A watchpoint is determined by the address and the byte size that resulted in
|
|
this particular instantiation. Each watchpoint has its settable options.
|
|
|
|
See also SBTarget.watchpoint_iter() for example usage of iterating through the
|
|
watchpoints of the target."
|
|
) SBWatchpoint;
|
|
class SBWatchpoint
|
|
{
|
|
public:
|
|
|
|
SBWatchpoint ();
|
|
|
|
SBWatchpoint (const lldb::SBWatchpoint &rhs);
|
|
|
|
~SBWatchpoint ();
|
|
|
|
bool
|
|
IsValid();
|
|
|
|
explicit operator bool() const;
|
|
|
|
bool operator==(const SBWatchpoint &rhs) const;
|
|
|
|
bool operator!=(const SBWatchpoint &rhs) const;
|
|
|
|
SBError
|
|
GetError();
|
|
|
|
watch_id_t
|
|
GetID ();
|
|
|
|
%feature("docstring", "
|
|
//------------------------------------------------------------------
|
|
/// With -1 representing an invalid hardware index.
|
|
//------------------------------------------------------------------
|
|
") GetHardwareIndex;
|
|
int32_t
|
|
GetHardwareIndex ();
|
|
|
|
lldb::addr_t
|
|
GetWatchAddress ();
|
|
|
|
size_t
|
|
GetWatchSize();
|
|
|
|
void
|
|
SetEnabled(bool enabled);
|
|
|
|
bool
|
|
IsEnabled ();
|
|
|
|
uint32_t
|
|
GetHitCount ();
|
|
|
|
uint32_t
|
|
GetIgnoreCount ();
|
|
|
|
void
|
|
SetIgnoreCount (uint32_t n);
|
|
|
|
%feature("docstring", "
|
|
//------------------------------------------------------------------
|
|
/// Get the condition expression for the watchpoint.
|
|
//------------------------------------------------------------------
|
|
") GetCondition;
|
|
const char *
|
|
GetCondition ();
|
|
|
|
%feature("docstring", "
|
|
//--------------------------------------------------------------------------
|
|
/// The watchpoint stops only if the condition expression evaluates to true.
|
|
//--------------------------------------------------------------------------
|
|
") SetCondition;
|
|
void
|
|
SetCondition (const char *condition);
|
|
|
|
bool
|
|
GetDescription (lldb::SBStream &description, DescriptionLevel level);
|
|
|
|
static bool
|
|
EventIsWatchpointEvent (const lldb::SBEvent &event);
|
|
|
|
static lldb::WatchpointEventType
|
|
GetWatchpointEventTypeFromEvent (const lldb::SBEvent& event);
|
|
|
|
static lldb::SBWatchpoint
|
|
GetWatchpointFromEvent (const lldb::SBEvent& event);
|
|
|
|
};
|
|
|
|
} // namespace lldb
|