断点存放在哪里?
在Windows上,断点存储在:
代码语言:javascript复制%APPDATA%/Code/User/workspaceStorage/(long_hash)/state.vscdb在Linux上,它们在(根据Matt的评论)中:
代码语言:javascript复制$HOME/.config/Code/User/workspaceStorage/(long_hash)/state.vscdb为了定位(long_hash),我添加了一个断点,并查找一个最近修改过的文件。如果您有西格温 bash,那么在添加或删除断点之后,这样的命令就能工作:
代码语言:javascript复制 $ cd $APPDATA/Code
$ find . -mmin -1state.vscdb文件是一个SQLite数据库。我可以使用strings (另一个Cygwin命令)从其中提取一些数据:
代码语言:javascript复制 $ 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}]以上是helloworld.cpp第12行的单个断点。
访问这个文件是个好主意吗?
可能不会!
如果您的目标是通过修改该文件来查询或操作断点,那么我要提醒您,这可能会破坏VSCode的内部存储(即使使用适当的SQLite客户端)。
我建议使用VSCode扩展API、debug.breakpoints和debug.addBreakpoints从VSCode中查询和修改它们。