Mac下vscode配置FFmpeg调试

时间:2024-04-03 11:54:12

最近在用vscode 写FFmpeg相关的代码,如果用命令行运行的话,有时候语法错误报的是段错误(segmentation fault),所以找了一下配置vscode 调试的方法,记录一下:


1,装一点小插件:
Mac下vscode配置FFmpeg调试


2,按照官方文档新建对应的配置文件:
官方文档
Mac下vscode配置FFmpeg调试


3,修改tasks.json配置文件:

{
  "version": "2.0.0",
  "tasks": [{
    "label": "Build with Clang",
    "type": "shell",
    "command": "clang",  
    "args": [
      "-g",
      "-o",
      "aacHello", //输出文件名
      "encode_audio.c",//编译的文件
      "-lavutil",//依赖
      "-lavcodec"//依赖
    ],
    "group": {
      "kind": "build",
      "isDefault": true
    }
  }]
}

4,修改lauch.json配置文件:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [{
    "name": "debug",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/aacHello", //要执行的文件
    "args": ["hello123.aac"],//输入参数
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "lldb",
    "logging": {
      "trace": true,
      "traceResponse": true,
      "engineLogging": true
    },
    "preLaunchTask": "Build with Clang",
  }]
}

5,调试情况
Mac下vscode配置FFmpeg调试
这样就可以断点调试啦!