7

In VSCode, where do the breakpoints store?

When I relaunch VSCode, those breakpoints still exists, so there should be a place for VSCode to store them. But it is stored neither in the workspace, nor in .vscode.

I need to know where they store so that I can backup/restore/add/modify/delete multiple breakpoints conveniently and efficiently.

2 Answers 2

9

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.

3
  • Thanks for your answer. And your suggestion really what I need.
    – Chen Tian
    Commented Sep 10, 2019 at 3:23
  • 2
    @ChenTian You're welcome! If this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. Commented Sep 10, 2019 at 3:59
  • Note that on linux (i'm using Archlinux) it is under ~/.config/Code/User Commented May 20, 2020 at 7:12
0

On mac, it's

~/Library/Application Support/Code/User/workspaceStorage/<hash>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.