144 字
1 分钟
VSCode 启用 Pretty Printing For GDB 以调试 vector 等 STL 容器
在我使用的gdb版本(GNU gdb (GDB) 15.2)中,无需额外配置即可启用。
在VSCode的launch.json文件中的setupCommands片段加入以下Json:
{ "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true}重新开始调试即可。
附完整配置文件:
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "C/C++: gcc build active file" } ]} 觉得这篇文章怎么样?
VSCode 启用 Pretty Printing For GDB 以调试 vector 等 STL 容器
https://www.nbbnbb.com.cn/posts/vscode-启用-pretty-printing-for-gdb-以调试-vector-等-stl-容器/