记录 | vscode pyhton c++调试launch.json配置

下面提供 vscode 中 python 和 c++ 调试配置的 launch.json (好用,已用好几年,建议收藏)

{
  // 使用 IntelliSense 了解相关属性。 
  // 悬停以查看现有属性的描述。
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "python debug",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "python": "/root/anaconda3/envs/py385/bin/python",
      "justMyCode": true,
      "cwd": "${fileDirname}"
    },
    {
      "name": "gdb debug",
      "type": "cppdbg",
      "request": "launch",
      "program": "/workspace/pro/facedet/build/release/facedet",
      "args": [],
      "miDebuggerPath": "/usr/bin/gdb",
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      // "cwd": "/workspace/pro/",
      "environment":  [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "为 gdb 启用整齐打印",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

若要配置传参,比如 python 调试的时候添加传参 (因为很多 py 脚本执行的时候都喜欢用 --xxx 来传参,这样调试的时候就不方便了),这个时候可以在 launch.json 中添加 args 参数
在这里插入图片描述
c++ 同理

相关推荐

  1. LVGL调试记录

    2023-12-07 06:36:09       6 阅读
  2. 【ubuntu】Vim配置记录

    2023-12-07 06:36:09       14 阅读
  3. Python实战:日志记录调试技巧

    2023-12-07 06:36:09       22 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-07 06:36:09       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-07 06:36:09       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-07 06:36:09       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-07 06:36:09       20 阅读

热门阅读

  1. 多个项目复用node_modules

    2023-12-07 06:36:09       35 阅读
  2. Tomcat的缺省端口是多少,怎么修改?

    2023-12-07 06:36:09       39 阅读
  3. svn服务端安装

    2023-12-07 06:36:09       41 阅读
  4. Pandas 打开有密码的Excel

    2023-12-07 06:36:09       31 阅读