diff options
author | Jason Molenda <jmolenda@apple.com> | 2023-09-20 13:18:12 -0700 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2023-09-20 13:42:16 -0700 |
commit | 933ad5c897ee366759a54869b35b2d7285a92137 (patch) | |
tree | 169d13adc3124c5d521b53fa88e0241a3471ba5f /lldb/bindings | |
parent | 618a22144db5e45da8c95dc22064103e1b5e5b71 (diff) | |
download | llvm-933ad5c897ee366759a54869b35b2d7285a92137.zip llvm-933ad5c897ee366759a54869b35b2d7285a92137.tar.gz llvm-933ad5c897ee366759a54869b35b2d7285a92137.tar.bz2 |
[lldb] Add 'modify' type watchpoints, make it default (#66308)
Watchpoints in lldb can be either 'read', 'write', or 'read/write'. This
is exposing the actual behavior of hardware watchpoints. gdb has a
different behavior: a "write" type watchpoint only stops when the
watched memory region *changes*.
A user is using a watchpoint for one of three reasons:
1. Want to find what is changing/corrupting this memory.
2. Want to find what is writing to this memory.
3. Want to find what is reading from this memory.
I believe (1) is the most common use case for watchpoints, and it
currently can't be done in lldb -- the user needs to continue every time
the same value is written to the watched-memory manually. I think gdb's
behavior is the correct one. There are some use cases where a developer
wants to find every function that writes/reads to/from a memory region,
regardless of value, I want to still allow that functionality.
This is also a bit of groundwork for my large watchpoint support
proposal
https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
where I will be adding support for AArch64 MASK watchpoints which watch
power-of-2 memory regions. A user might ask to watch 24 bytes, and a
MASK watchpoint stub can do this with a 32-byte MASK watchpoint if it is
properly aligned. And we need to ignore writes to the final 8 bytes of
that watched region, and not show those hits to the user.
This patch adds a new 'modify' watchpoint type and it is the default.
Re-landing this patch after addressing testsuite failures found in CI on
Linux, Intel machines, and windows.
rdar://108234227
Diffstat (limited to 'lldb/bindings')
-rw-r--r-- | lldb/bindings/headers.swig | 1 | ||||
-rw-r--r-- | lldb/bindings/interface/SBWatchpointOptionsDocstrings.i | 12 | ||||
-rw-r--r-- | lldb/bindings/interfaces.swig | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig index f787176..d392ed4 100644 --- a/lldb/bindings/headers.swig +++ b/lldb/bindings/headers.swig @@ -77,4 +77,5 @@ #include "lldb/API/SBValueList.h" #include "lldb/API/SBVariablesOptions.h" #include "lldb/API/SBWatchpoint.h" +#include "lldb/API/SBWatchpointOptions.h" %} diff --git a/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i b/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i new file mode 100644 index 0000000..370bf95 --- /dev/null +++ b/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i @@ -0,0 +1,12 @@ +%feature("docstring", +"A container for options to use when creating watchpoints." +) lldb::SBWatchpointOptions; + +%feature("docstring", "Sets whether the watchpoint should stop on read accesses." +) lldb::SBWatchpointOptions::SetWatchpointTypeRead; +%feature("docstring", "Gets whether the watchpoint should stop on read accesses." +) lldb::SBWatchpointOptions::GetWatchpointTypeRead; +%feature("docstring", "Sets whether the watchpoint should stop on write accesses. eWatchpointWriteTypeOnModify is the most commonly useful mode, where lldb will stop when the watched value has changed. eWatchpointWriteTypeAlways will stop on any write to the watched region, even if it's the value is the same." +) lldb::SBWatchpointOptions::SetWatchpointTypeWrite; +%feature("docstring", "Gets whether the watchpoint should stop on write accesses, returning WatchpointWriteType to indicate the type of write watching that is enabled, or eWatchpointWriteTypeDisabled." +) lldb::SBWatchpointOptions::GetWatchpointTypeWrite; diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig index 53f8fcc..306cfe6 100644 --- a/lldb/bindings/interfaces.swig +++ b/lldb/bindings/interfaces.swig @@ -80,6 +80,7 @@ %include "./interface/SBValueListDocstrings.i" %include "./interface/SBVariablesOptionsDocstrings.i" %include "./interface/SBWatchpointDocstrings.i" +%include "./interface/SBWatchpointOptionsDocstrings.i" /* API headers */ %include "lldb/API/SBAddress.h" @@ -152,6 +153,7 @@ %include "lldb/API/SBValueList.h" %include "lldb/API/SBVariablesOptions.h" %include "lldb/API/SBWatchpoint.h" +%include "lldb/API/SBWatchpointOptions.h" /* Extensions for SB classes */ %include "./interface/SBAddressExtensions.i" |