vscode debug的方式

在.vscode文件夹下建立launch.json

例子1:调试python

来自

https://github.com/chunleili/tiPBD/tree/amg

复制代码
{
    "version": "0.2.0",
    "configurations": [
            {
            "name": "hpbd 5 5",
            "type": "python",
            "request": "launch",
            "program": "engine/volumetric/arap_multigrid.py",
            "console": "integratedTerminal",
            "args": ["--fine_iterations", "5",
                     "--coarse_iterations", "5",
                     "--solver_type", "Jacobian",
                     "--multigrid_type", "HPBD"
                    ]
        },
    ]
}

逐行解释:

name是显示在侧边栏的名字,例如

program是要调试的程序

console是console打开的类型,分为内部(vscode内)和外部(额外弹出个终端模拟器)

args是调试传入参数,注意对应于命令行的每个空格都要单独分一个词。

例子2:调试c++

参考

https://github.com/chunleili/fast_mass_spring

json 复制代码
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(msvc) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            // Resolved by CMake Tools:
            "program": "${workspaceFolder}/fast_mass_spring/main.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}/fast_mass_spring",
            "environment": [
                {
                    "name": "PATH",
                    "value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
                }
            ],
            "console": "externalTerminal"
        }
    ]
}

这里额外增加了几个

cwd是设定当前目录

stopAtEntry是是否在程序第一句暂停

environment是设定环境变量,这里将${command:cmake.getLaunchTargetDirectory}追加到PATH最后

GUI的使用

如图,

相关推荐
VIP_CQCRE7 小时前
把 OpenCode 接入 Ace Data Cloud:让 VS Code、Cursor、Windsurf 统一调用 AI 编程模型
vscode·大模型·ai编程·opencode·acedatacloud
LCDduhui9 小时前
如何选择适配自己设备的液晶屏
编辑器
木由里予11 小时前
GDB 使用手册(详细版)
c语言·vscode
广东帝工11 小时前
桥梁防撞主动预警系统优势
编辑器
阿伟玩不懂14 小时前
接入第一个 MCP Server:让 AI 自己看你的数据库
ide·人工智能
2501_915909067 天前
移动端开发工具链怎么组合比较好,iOS、Android、跨端三套配置方案
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
weixin_464078077 天前
ppt转为draw.io方法
编辑器
sunoo-2297 天前
【ARM嵌入式学习笔记Day6】一文打通i.MX6ULL时钟体系:PLL/PFD/预分频+滞回比较器全解析
arm开发·笔记·vscode·单片机·imx6ull·汇编语言
明天…ling7 天前
gitee与vscode远程连接
vscode·gitee
2501_915918417 天前
iOS编程用什么软件好?主流工具Xcode、AppCode、CodeRunner与新兴快蝎对比
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程