Skip to content

Commit 35e3939

Browse files
committed
watch set expression's default type was wrong with new modify type
`watch set expression` was passing the OptionGroupWatchpoint enum in to Target where the LLDB_WATCH_TYPE_* bitfield was expected. Modify matched READ|WRITE and resulted in a test failure in TestWatchTaggedAddress.py. David temporarily changed the test to expect this incorrect output; this fixes the bug and updates the test case to test it for correctness again.
1 parent 03c698a commit 35e3939

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lldb/source/Commands/CommandObjectWatchpoint.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,23 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw {
11331133
size = target->GetArchitecture().GetAddressByteSize();
11341134

11351135
// Now it's time to create the watchpoint.
1136-
uint32_t watch_type = m_option_watchpoint.watch_type;
1136+
uint32_t watch_type;
1137+
switch (m_option_watchpoint.watch_type) {
1138+
case OptionGroupWatchpoint::eWatchRead:
1139+
watch_type = LLDB_WATCH_TYPE_READ;
1140+
break;
1141+
case OptionGroupWatchpoint::eWatchWrite:
1142+
watch_type = LLDB_WATCH_TYPE_WRITE;
1143+
break;
1144+
case OptionGroupWatchpoint::eWatchModify:
1145+
watch_type = LLDB_WATCH_TYPE_MODIFY;
1146+
break;
1147+
case OptionGroupWatchpoint::eWatchReadWrite:
1148+
watch_type = LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE;
1149+
break;
1150+
default:
1151+
watch_type = LLDB_WATCH_TYPE_MODIFY;
1152+
}
11371153

11381154
// Fetch the type from the value object, the type of the watched object is
11391155
// the pointee type

lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_watch_set_on_tagged_ptr(self):
9696
self.expect(
9797
"watchpoint set expression -s 4 -- tagged_ptr",
9898
WATCHPOINT_CREATED,
99-
substrs=["Watchpoint created", "size = 4", "type = rw"],
99+
substrs=["Watchpoint created", "size = 4", "type = m"],
100100
)
101101

102102
self.verify_watch_hits()

0 commit comments

Comments
 (0)