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

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 28 15:00:26 PST 2023


mib added inline comments.


================
Comment at: lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py:68
+            self.runCmd('watchpoint set variable -w read_write -- global')
+            watchpoint = target.GetWatchpointAtIndex(0)
+            self.assertTrue(watchpoint.IsWatchVariable())
----------------
delcypher wrote:
> mib wrote:
> > `runCmd` doesn't check if the command succeeded, so you probably want to add an asset to check the number of watchpoint on the target is not zero.
> @mib Did I misunderstand something? `runCmd` has this in the end of its implementation.
> 
> ```lang=python
>         if check:
>             output = ""
>             if self.res.GetOutput():
>                 output += "\nCommand output:\n" + self.res.GetOutput()
>             if self.res.GetError():
>                 output += "\nError output:\n" + self.res.GetError()
>             if msg:
>                 msg += output
>             if cmd:
>                 cmd += output
>             self.assertTrue(self.res.Succeeded(),
>                             msg if (msg) else CMD_MSG(cmd))
> ```
> 
> and `check` is set to `True` by default.
> 
> So it looks like `runCmd` does check that the command succeeded.
In that case, it's fine. Otherwise, I'd have expected to have `self.assertGreater(target.GetNumWatchpoints(), 0)` before calling `target.GetWatpointAtIndex(0)`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144937/new/

https://reviews.llvm.org/D144937



More information about the lldb-commits mailing list