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的使用

如图,

相关推荐
承渊政道7 分钟前
C++学习之旅【C++类和对象(上)】
c语言·c++·学习·编辑器
拿我格子衫来17 分钟前
图形编辑器基于Paper.js教程32:绘制贝塞尔曲线,并进行二次编辑
javascript·图像处理·编辑器·图形渲染
fruge18 分钟前
AI Ping 免费领算力,VsCode结合Roo Code实现免费编程
ide·人工智能·vscode
渔舟唱晚@1 小时前
从原理到实现:基于 Y.js 和 Tiptap 的实时在线协同编辑器全解析
开发语言·javascript·编辑器
AndreasEmil3 小时前
JavaSE - 继承
java·开发语言·ide·vscode·intellij-idea·idea
银迢迢11 小时前
idea控制台中文乱码采用好几种方法一直解决不了
java·ide·intellij-idea
好好沉淀12 小时前
IDEA 取消 Save Actions 自动删除未用导入(前端开发避坑)
java·ide·intellij-idea
添加shujuqudong1如果未回复13 小时前
深度探索:自动驾驶路径规划与避障功能实现——从运动学到动力学模型到决策规划算法的完整系列
ide
淡水瑜16 小时前
Visual Studio 实操
ide·visual studio
aduzhe19 小时前
vscode 自动化格式问题
ide·vscode·自动化