Skip to content

Commit a7b78ca

Browse files
committed
Revert "[lldb] Add 'modify' type watchpoints, make it default (#66308)"
This reverts commit 933ad5c. This caused 1 test failure and an unexpected pass on AArch64 Linux: https://lab.llvm.org/buildbot/#/builders/96/builds/45765 Wasn't reported because the bot was already red at the time.
1 parent fe87d62 commit a7b78ca

File tree

32 files changed

+61
-393
lines changed

32 files changed

+61
-393
lines changed

lldb/bindings/headers.swig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,4 @@
7777
#include "lldb/API/SBValueList.h"
7878
#include "lldb/API/SBVariablesOptions.h"
7979
#include "lldb/API/SBWatchpoint.h"
80-
#include "lldb/API/SBWatchpointOptions.h"
8180
%}

lldb/bindings/interface/SBWatchpointOptionsDocstrings.i

Lines changed: 0 additions & 12 deletions
This file was deleted.

lldb/bindings/interfaces.swig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
%include "./interface/SBValueListDocstrings.i"
8181
%include "./interface/SBVariablesOptionsDocstrings.i"
8282
%include "./interface/SBWatchpointDocstrings.i"
83-
%include "./interface/SBWatchpointOptionsDocstrings.i"
8483

8584
/* API headers */
8685
%include "lldb/API/SBAddress.h"
@@ -153,7 +152,6 @@
153152
%include "lldb/API/SBValueList.h"
154153
%include "lldb/API/SBVariablesOptions.h"
155154
%include "lldb/API/SBWatchpoint.h"
156-
%include "lldb/API/SBWatchpointOptions.h"
157155

158156
/* Extensions for SB classes */
159157
%include "./interface/SBAddressExtensions.i"

lldb/include/lldb/API/SBTarget.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "lldb/API/SBType.h"
2222
#include "lldb/API/SBValue.h"
2323
#include "lldb/API/SBWatchpoint.h"
24-
#include "lldb/API/SBWatchpointOptions.h"
2524

2625
namespace lldb_private {
2726
namespace python {
@@ -829,13 +828,8 @@ class LLDB_API SBTarget {
829828

830829
lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);
831830

832-
LLDB_DEPRECATED("WatchAddress deprecated, use WatchpointCreateByAddress")
833831
lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
834-
bool modify, SBError &error);
835-
836-
lldb::SBWatchpoint
837-
WatchpointCreateByAddress(lldb::addr_t addr, size_t size,
838-
lldb::SBWatchpointOptions options, SBError &error);
832+
bool write, SBError &error);
839833

840834
bool EnableAllWatchpoints();
841835

lldb/include/lldb/API/SBWatchpointOptions.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

lldb/include/lldb/Breakpoint/Watchpoint.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
7676

7777
bool WatchpointRead() const;
7878
bool WatchpointWrite() const;
79-
bool WatchpointModify() const;
8079
uint32_t GetIgnoreCount() const;
8180
void SetIgnoreCount(uint32_t n);
8281
void SetWatchpointType(uint32_t type, bool notify = true);
8382
void SetDeclInfo(const std::string &str);
8483
std::string GetWatchSpec();
8584
void SetWatchSpec(const std::string &str);
86-
bool WatchedValueReportable(const ExecutionContext &exe_ctx);
8785

8886
// Snapshot management interface.
8987
bool IsWatchVariable() const;
@@ -214,8 +212,7 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
214212
// again, we check the count, if it is more than 1, it means the user-
215213
// supplied actions actually want the watchpoint to be disabled!
216214
uint32_t m_watch_read : 1, // 1 if we stop when the watched data is read from
217-
m_watch_write : 1, // 1 if we stop when the watched data is written to
218-
m_watch_modify : 1; // 1 if we stop when the watched data is changed
215+
m_watch_write : 1; // 1 if we stop when the watched data is written to
219216
uint32_t m_ignore_count; // Number of times to ignore this watchpoint
220217
std::string m_decl_str; // Declaration information, if any.
221218
std::string m_watch_spec_str; // Spec for the watchpoint.

lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ class OptionGroupWatchpoint : public OptionGroup {
3030

3131
void OptionParsingStarting(ExecutionContext *execution_context) override;
3232

33-
/// eWatchRead == LLDB_WATCH_TYPE_READ
34-
/// eWatchWrite == LLDB_WATCH_TYPE_WRITE
35-
/// eWatchModify == LLDB_WATCH_TYPE_MODIFY
36-
/// eWatchReadWrite == LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE
33+
// Note:
34+
// eWatchRead == LLDB_WATCH_TYPE_READ; and
35+
// eWatchWrite == LLDB_WATCH_TYPE_WRITE
3736
enum WatchType {
3837
eWatchInvalid = 0,
3938
eWatchRead,
4039
eWatchWrite,
41-
eWatchModify,
4240
eWatchReadWrite
4341
};
4442

lldb/include/lldb/lldb-defines.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@
4444
#define LLDB_WATCH_ID_IS_VALID(uid) ((uid) != (LLDB_INVALID_WATCH_ID))
4545
#define LLDB_WATCH_TYPE_READ (1u << 0)
4646
#define LLDB_WATCH_TYPE_WRITE (1u << 1)
47-
#define LLDB_WATCH_TYPE_MODIFY (1u << 2)
4847
#define LLDB_WATCH_TYPE_IS_VALID(type) \
49-
((type & LLDB_WATCH_TYPE_READ) || (type & LLDB_WATCH_TYPE_WRITE) || \
50-
(type & LLDB_WATCH_TYPE_MODIFY))
48+
((type & LLDB_WATCH_TYPE_READ) || (type & LLDB_WATCH_TYPE_WRITE))
5149

5250
// Generic Register Numbers
5351
#define LLDB_REGNUM_GENERIC_PC 0 // Program Counter

lldb/include/lldb/lldb-enumerations.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -431,21 +431,6 @@ FLAGS_ENUM(WatchpointEventType){
431431
eWatchpointEventTypeThreadChanged = (1u << 11),
432432
eWatchpointEventTypeTypeChanged = (1u << 12)};
433433

434-
enum WatchpointWriteType {
435-
/// Don't stop when the watched memory region is written to.
436-
eWatchpointWriteTypeDisabled,
437-
/// Stop on any write access to the memory region, even if
438-
/// the value doesn't change. On some architectures, a write
439-
/// near the memory region may be falsely reported as a match,
440-
/// and notify this spurious stop as a watchpoint trap.
441-
eWatchpointWriteTypeAlways,
442-
/// Stop on a write to the memory region that changes its value.
443-
/// This is most likely the behavior a user expects, and is the
444-
/// behavior in gdb. lldb can silently ignore writes near the
445-
/// watched memory region that are reported as accesses to lldb.
446-
eWatchpointWriteTypeOnModify
447-
};
448-
449434
/// Programming language type.
450435
///
451436
/// These enumerations use the same language enumerations as the DWARF

lldb/include/lldb/lldb-forward.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ class VariableList;
284284
class Watchpoint;
285285
class WatchpointList;
286286
class WatchpointOptions;
287-
class WatchpointSetOptions;
288287
struct CompilerContext;
289288
struct LineEntry;
290289
struct PropertyDefinition;

lldb/source/API/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ add_lldb_library(liblldb SHARED ${option_framework}
9191
SBValueList.cpp
9292
SBVariablesOptions.cpp
9393
SBWatchpoint.cpp
94-
SBWatchpointOptions.cpp
9594
SBUnixSignals.cpp
9695
SystemInitializerFull.cpp
9796
${lldb_python_wrapper}

lldb/source/API/SBTarget.cpp

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,39 +1322,27 @@ SBWatchpoint SBTarget::FindWatchpointByID(lldb::watch_id_t wp_id) {
13221322
}
13231323

13241324
lldb::SBWatchpoint SBTarget::WatchAddress(lldb::addr_t addr, size_t size,
1325-
bool read, bool modify,
1325+
bool read, bool write,
13261326
SBError &error) {
13271327
LLDB_INSTRUMENT_VA(this, addr, size, read, write, error);
13281328

1329-
SBWatchpointOptions options;
1330-
options.SetWatchpointTypeRead(read);
1331-
options.SetWatchpointTypeWrite(eWatchpointWriteTypeOnModify);
1332-
return WatchpointCreateByAddress(addr, size, options, error);
1333-
}
1334-
1335-
lldb::SBWatchpoint
1336-
SBTarget::WatchpointCreateByAddress(lldb::addr_t addr, size_t size,
1337-
SBWatchpointOptions options,
1338-
SBError &error) {
1339-
LLDB_INSTRUMENT_VA(this, addr, size, options, error);
1340-
13411329
SBWatchpoint sb_watchpoint;
13421330
lldb::WatchpointSP watchpoint_sp;
13431331
TargetSP target_sp(GetSP());
1344-
uint32_t watch_type = 0;
1345-
if (options.GetWatchpointTypeRead())
1346-
watch_type |= LLDB_WATCH_TYPE_READ;
1347-
if (options.GetWatchpointTypeWrite() == eWatchpointWriteTypeAlways)
1348-
watch_type |= LLDB_WATCH_TYPE_WRITE;
1349-
if (options.GetWatchpointTypeWrite() == eWatchpointWriteTypeOnModify)
1350-
watch_type |= LLDB_WATCH_TYPE_MODIFY;
1351-
if (watch_type == 0) {
1352-
error.SetErrorString("Can't create a watchpoint that is neither read nor "
1353-
"write nor modify.");
1354-
return sb_watchpoint;
1355-
}
1356-
if (target_sp && addr != LLDB_INVALID_ADDRESS && size > 0) {
1332+
if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS &&
1333+
size > 0) {
13571334
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1335+
uint32_t watch_type = 0;
1336+
if (read)
1337+
watch_type |= LLDB_WATCH_TYPE_READ;
1338+
if (write)
1339+
watch_type |= LLDB_WATCH_TYPE_WRITE;
1340+
if (watch_type == 0) {
1341+
error.SetErrorString(
1342+
"Can't create a watchpoint that is neither read nor write.");
1343+
return sb_watchpoint;
1344+
}
1345+
13581346
// Target::CreateWatchpoint() is thread safe.
13591347
Status cw_error;
13601348
// This API doesn't take in a type, so we can't figure out what it is.

lldb/source/API/SBValue.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,17 +1433,10 @@ lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
14331433
return sb_watchpoint;
14341434

14351435
uint32_t watch_type = 0;
1436-
if (read) {
1436+
if (read)
14371437
watch_type |= LLDB_WATCH_TYPE_READ;
1438-
// read + write, the most likely intention
1439-
// is to catch all writes to this, not just
1440-
// value modifications.
1441-
if (write)
1442-
watch_type |= LLDB_WATCH_TYPE_WRITE;
1443-
} else {
1444-
if (write)
1445-
watch_type |= LLDB_WATCH_TYPE_MODIFY;
1446-
}
1438+
if (write)
1439+
watch_type |= LLDB_WATCH_TYPE_WRITE;
14471440

14481441
Status rc;
14491442
CompilerType type(value_sp->GetCompilerType());

lldb/source/API/SBWatchpoint.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ bool SBWatchpoint::IsWatchingWrites() {
354354
std::lock_guard<std::recursive_mutex> guard(
355355
watchpoint_sp->GetTarget().GetAPIMutex());
356356

357-
return watchpoint_sp->WatchpointWrite() ||
358-
watchpoint_sp->WatchpointModify();
357+
return watchpoint_sp->WatchpointWrite();
359358
}
360359

361360
return false;

lldb/source/API/SBWatchpointOptions.cpp

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)