[Lldb-commits] [lldb] [lldb] refactor watchpoint functionality (PR #159807)

via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 19 12:30:54 PDT 2025


dlav-sc wrote:

**III ==== StopInfo.cpp =============================================**

Besides moving the logic from `StopInfoWatchpoint::PerformAction` into `Watchpoint::WatchedValueReportable` as mentioned above, I also endeavored to improve the overall readability of `StopInfoWatchpoint::PerformAction` itself, for example by extracting logic into separate functions https://github.com/llvm/llvm-project/pull/159807/files#diff-08d3a818bf87a1dc1d1558dec9570f8b4f27fb0a1bd0a8d37c74b29d43a8b92aR963-R981 https://github.com/llvm/llvm-project/pull/159807/files#diff-08d3a818bf87a1dc1d1558dec9570f8b4f27fb0a1bd0a8d37c74b29d43a8b92aR903-R909 .

**IV ==== lldb-enumeration.h ========================================**

I added a separate enum https://github.com/llvm/llvm-project/pull/159807/files#diff-62036fb08830b445f086a17fd4be2132b4dc1da85446791d8c101574edbf58f3R1084 to describe whether a watchpoint is software or hardware. Using an `is_hardware` flag seems less than ideal to me, as it reduces code readability.

**IV ==== Target.cpp ===============================================**

I renamed the `CreateWatchpoint` function to `CreateWatchpointByAddress` because I plan to add a `CreateWatchpointByExpression` function. Furthermore, I tried to extract common logic for the `CreateWatchpointByAddress` and future `CreateWatchpointByExpression` functions into separate helper functions https://github.com/llvm/llvm-project/pull/159807/files#diff-dcc80a369493ccabaf85b5492444457f8ce3f44c8be983dc01be9330f424e35cR945-R1033, which also improves code readability.

https://github.com/llvm/llvm-project/pull/159807


More information about the lldb-commits mailing list