aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectWatchpoint.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2023-09-21 10:21:53 +0000
committerDavid Spickett <david.spickett@linaro.org>2023-09-21 10:35:15 +0000
commit75e862077834c06e574d34e8958dd2ee7cc1d334 (patch)
tree24b227451022b0ad2f0a22aecbdaf94aad9bf876 /lldb/source/Commands/CommandObjectWatchpoint.cpp
parent618e5d2c2d8e0c288c37b883ece553ca4f994c2e (diff)
downloadllvm-75e862077834c06e574d34e8958dd2ee7cc1d334.zip
llvm-75e862077834c06e574d34e8958dd2ee7cc1d334.tar.gz
llvm-75e862077834c06e574d34e8958dd2ee7cc1d334.tar.bz2
Reland "[lldb] Add 'modify' type watchpoints, make it default (#66308)"
This reverts commit a7b78cac9a77e3ef6bbbd8ab1a559891dc693401. With updates to the tests. TestWatchTaggedAddress.py: Updated the expected watchpoint types, though I'm not sure there should be a differnt default for the two ways of setting them, that needs to be confirmed. TestStepOverWatchpoint.py: Skipped this everywhere because I think what used to happen is you couldn't put 2 watchpoints on the same address (after alignment). I guess that this is now allowed because modify watchpoints aren't accounted for, but likely should be. Needs investigating.
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index a4929ea..83c2fb8 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -803,7 +803,7 @@ public:
"Set a watchpoint on a variable. "
"Use the '-w' option to specify the type of watchpoint and "
"the '-s' option to specify the byte size to watch for. "
- "If no '-w' option is specified, it defaults to write. "
+ "If no '-w' option is specified, it defaults to modify. "
"If no '-s' option is specified, it defaults to the variable's "
"byte size. "
"Note that there are limited hardware resources for watchpoints. "
@@ -878,9 +878,9 @@ protected:
return false;
}
- // If no '-w' is specified, default to '-w write'.
+ // If no '-w' is specified, default to '-w modify'.
if (!m_option_watchpoint.watch_type_specified) {
- m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite;
+ m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchModify;
}
// We passed the sanity check for the command. Proceed to set the
@@ -947,7 +947,23 @@ protected:
}
// Now it's time to create the watchpoint.
- uint32_t watch_type = m_option_watchpoint.watch_type;
+ uint32_t watch_type = 0;
+ switch (m_option_watchpoint.watch_type) {
+ case OptionGroupWatchpoint::eWatchModify:
+ watch_type |= LLDB_WATCH_TYPE_MODIFY;
+ break;
+ case OptionGroupWatchpoint::eWatchRead:
+ watch_type |= LLDB_WATCH_TYPE_READ;
+ break;
+ case OptionGroupWatchpoint::eWatchReadWrite:
+ watch_type |= LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE;
+ break;
+ case OptionGroupWatchpoint::eWatchWrite:
+ watch_type |= LLDB_WATCH_TYPE_WRITE;
+ break;
+ case OptionGroupWatchpoint::eWatchInvalid:
+ break;
+ };
error.Clear();
WatchpointSP watch_sp =
@@ -999,7 +1015,7 @@ public:
"Use the '-l' option to specify the language of the expression. "
"Use the '-w' option to specify the type of watchpoint and "
"the '-s' option to specify the byte size to watch for. "
- "If no '-w' option is specified, it defaults to write. "
+ "If no '-w' option is specified, it defaults to modify. "
"If no '-s' option is specified, it defaults to the target's "
"pointer byte size. "
"Note that there are limited hardware resources for watchpoints. "
@@ -1013,7 +1029,7 @@ public:
R"(
Examples:
-(lldb) watchpoint set expression -w write -s 1 -- foo + 32
+(lldb) watchpoint set expression -w modify -s 1 -- foo + 32
Watches write access for the 1-byte region pointed to by the address 'foo + 32')");
@@ -1073,7 +1089,7 @@ protected:
// If no '-w' is specified, default to '-w write'.
if (!m_option_watchpoint.watch_type_specified) {
- m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite;
+ m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchModify;
}
// We passed the sanity check for the command. Proceed to set the