[Lldb-commits] [PATCH] D144937: [LLDB] Expose several methods in SBWatchpoint

Dan Liew via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 27 18:13:23 PST 2023


delcypher created this revision.
Herald added a project: All.
delcypher requested review of this revision.
Herald added a project: LLDB.

This patch adds the following methods:

- `GetType()`
- `IsWatchVariable()`
- `GetWatchSpec()`

These effectively expose methods that `lldb_private::Watchpoint` already
had. Tests are included that exercise these new methods.

The motivation for exposing these are as follows:

- `GetType()` - With this information and the address from a watchpoint it is now possible to construct an SBValue from an SBWatchpoint. Previously this wasn't possible. The included test case illustrates doing this.
- `IsWatchVariable()` - This allows the caller to determine whether the watchpoint is a variable watchpoint or an expression watchpoint.
- `GetWatchSpec()` - This allows (at least for variable watchpoints) to use a sensible name for SBValues created from an SBWatchpoint.

The implementation of `GetWatchSpec()` isn't ideal. It currently caches
the string because `lldb_private::Watchpoint` does not publicly expose
the underlying memory its using to store the spec string. This is
probably fine though because the cost for this is only really paid if
`GetWatchSpec()` is called (unlikely given that its a new API).

rdar://105606978

Reviewersa jingham, mib, bulbazord, jasonmolenda, JDevlieghere


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144937

Files:
  lldb/bindings/interface/SBWatchpointDocstrings.i
  lldb/include/lldb/API/SBType.h
  lldb/include/lldb/API/SBWatchpoint.h
  lldb/source/API/SBWatchpoint.cpp
  lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
  lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144937.500992.patch
Type: text/x-patch
Size: 8778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230228/46e0c6b0/attachment.bin>


More information about the lldb-commits mailing list