Where are the breakpoints stored?
On Windows, the breakpoints are stored in:
%APPDATA%/Code/User/workspaceStorage/(long_hash)/state.vscdb
On Linux, they are in (per Matt's comment):
$HOME/.config/Code/User/workspaceStorage/(long_hash)/state.vscdb
To locate the (long_hash)
, I added a breakpoint and looked for a file that was recently modified. If you have Cygwin bash, a command like this works, right after adding or removing a breakpoint:
$ cd $APPDATA/Code
$ find . -mmin -1
The state.vscdb
file is a SQLite database. I'm able to pull some data out of it using strings
(another Cygwin command):
$ strings state.vscdb | grep 'debug.breakpoint'
debug.breakpoint
debug.breakpoint
debug.breakpoint[{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":12},{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":13}]g
debug.breakpoint[{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":12}]
The above is with a single breakpoint at helloworld.cpp
line 12.
Is accessing this file a good idea?
Probably not!
If your goal is to query or manipulate the breakpoints yourself by modifying this file, I'd caution that that risks corrupting VSCode's internal storage (even if using a proper SQLite client).
I recommend instead using the VSCode extension APIs debug.breakpoints
and debug.addBreakpoints
to query and modify them from within VSCode.