How to set data breakpoints (i.e. watchpoints) on VSCode

Viewed 4255

I am no expert in VSCode, but I saw that since version 1.38 there is the possibility to add watchpoints (a breakpoint which breaks when a given memory area is modified, a feature that is supported by many debuggers), at least for C/C++, see here https://jaxenter.com/vs-code-1-38-161797.html and here https://github.com/microsoft/vscode/issues/58304. Now my version of VSCode is 1.48.2, and I still can't figure out how to do it, and I couldn't find a proper explanation either. If anyone can give an explanation on how to do it (or whether it is possible), for sure it will very beneficial for me and for the VSCode community.

1 Answers

I personally use the CodeLLDB extension for C++ debugging as I use LLDB. The way I create a variable watchpoint:

  • Put a regular break-point at where the variable is defined
  • Upon hitting the break-point, find the variable in the Variables pane, right click, and choose Break When Value Changes
Related