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

如图,

相关推荐
bkspiderx2 小时前
在Visual Studio中安装与配置Qt插件(Qt Visual Studio Tools)
ide·qt·visual studio·qt插件
lusklusklusk17 小时前
使用Visual Studio一步步创建并部署SSRS_PBIRS报表:数据源配置、图表设计、参数化查询、部署参数与排错实战
数据库·ide·visual studio
解道Jdon1 天前
Rust重写OpenCode Rune:性能提升最高100倍
ide·windows·git·svn·eclipse·github·visual studio
莫卢俊德1 天前
vscode ssh config
ide·vscode·ssh
郝学胜-神的一滴2 天前
Effective Python 条款44:善用属性注解
开发语言·c++·vscode·python·算法·stl
BD_Marathon6 天前
安装Jupyter notebook
ide·python·jupyter
讓丄帝愛伱7 天前
Zed Markdown 预览不能铺满全屏的原因及解决
ide
FungLeo7 天前
FengCMS · PHP+MySQL 升级实录 · 编辑器迁移:KindEditor → wangEditor5 +服务端 HTML Purifier
mysql·编辑器·php·富文本编辑器·fengcms
BD_Marathon7 天前
Jupyter魔法命令
ide·python·jupyter
郝学胜-神的一滴8 天前
Effective STL 条款 07:指针容器销毁前先删除
开发语言·c++·vscode·leetcode·rpc·visual studio