网站首页 > 博客文章 正文
准备知识:Debug C++ in Visual Studio Code
ffmpeg 源码 github.com/FFmpeg/FFmp…
调试ffmpeg_g, ffplay_g
ffmpeg 配置, 使其支持调试
关于-g3相关知识gcc-g-vs-g3-gdb-flag-what-is-the-difference
./configure --disable-optimizations --disable-stripping --enable-debug=3 --disable-doc
make -j `nproc`
以_g结尾的就是可以调试的程序ffmpeg_g, ffplay_g, ffprobe_g
vscode配置
如下命令:
# macOS上列出所有的音视频设备
ffmpeg -f avfoundation -list_devices true -i ""
launch.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": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/ffmpeg_g",
"args": ["-f", "avfoundation", "-list_devices", "true", "-i", "\"\""],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
}
]
}
打上断点,点击运行,就可以愉快的调试了
附上链接:lldb 使用教程 Tutorial
相关学习资料推荐,点击下方链接免费报名,先码住不迷路~】
音视频免费学习地址:FFmpeg/WebRTC/RTMP/NDK/Android音视频流媒体高级开发
【免费分享】音视频学习资料包、大厂面试题、技术视频和学习路线图,资料包括(C/C++,Linux,FFmpeg webRTC rtmp hls rtsp ffplay srs 等等)有需要的可以点击788280672加群免费领取~
调试ffmpeg/doc/example
make examples
在ffmpeg/doc/example目录下, 以_g结尾的就是可以调试的
配置launch.json
开始调试吧
修改代码重新编译
例如你在调试的时候,修改了ffmpeg的源码,想调试一下更改后的代码,需要重新编译生成。
cd ffmpeg
make -j 16
make examples
你想自动化这个过程,在调试之前自动编译,如何实现呢?
配置prelaunchTask
- 在tasks.json中添加一个task
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make -j 16; make examples",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceFolder}"
}
}
]
}
在launch.json中配置prelaunchTask
然后修改代码,点击调试, vscode 自动执行make,编译修改后的文件,重新生成可执行程序。不用每次修改完想看看效果,还要手动去执行make,效率又提高了
备注:m1 芯片的mac 如果遇到调试问题
ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed ((os/kern) invalid argument))
解决办法:
使用 CodeLLDB debugger插件,而不是vc code 原生的调试插件
作者:yxibng
链接:https://juejin.cn/post/70730843
猜你喜欢
- 2024-09-21 Mac系统VSCode设置向下复制粘贴快捷键(Ctrl+D)
- 2024-09-21 解决Mac下VSCode打开zsh乱码(mac vs code如何设置中文)
- 2024-09-21 Atom, Vim, Visual Studio Code, Emacs 哪个好?
- 2024-09-21 分享一份嵌入式软件工具清单(嵌入式相关软件)
- 2024-09-21 老生常谈:Windows和MacOS到底哪个好用?
- 2024-09-21 TensorFlow为新旧Mac特供新版本,速度最高提升7倍
- 2024-09-21 人生苦短,我要在VSCode里面用Python
- 2024-09-21 mac vscode找不到git(mac安装vscode找不到)
- 2024-09-21 快乐Coding,必须要有一个高颜值的代码编辑器,主题+字体推荐
- 2024-09-21 Mac vscode如何关闭鼠标和键盘的列选择功能?
你 发表评论:
欢迎- 07-02在线学习在爱奇艺信息流推荐业务中的探索与实践
- 07-02Diallyl Trisulfide(H2S donor)二烯丙基三硫:合成方法与工艺
- 07-02MitoSOX Red Mitochondrial Superoxide Indicator使用方法
- 07-02深度时空网络、记忆网络与特征表达学习在 CTR 预估中的应用
- 07-02iFluor 488标记鬼笔环肽可通过标记F-actin,研究细胞在迁移等
- 07-02快速了解红色线粒体超氧化物荧光探针的基本特性
- 07-02腔肠素400A(Coelenteramine 400a)综合解析,一文掌握所有要点!
- 07-02Chinese doctor Zhang Junqiao's heroic act exemplifies deep China-Africa friendship: FM spokesperson
- 最近发表
-
- 在线学习在爱奇艺信息流推荐业务中的探索与实践
- Diallyl Trisulfide(H2S donor)二烯丙基三硫:合成方法与工艺
- MitoSOX Red Mitochondrial Superoxide Indicator使用方法
- 深度时空网络、记忆网络与特征表达学习在 CTR 预估中的应用
- iFluor 488标记鬼笔环肽可通过标记F-actin,研究细胞在迁移等
- 快速了解红色线粒体超氧化物荧光探针的基本特性
- 腔肠素400A(Coelenteramine 400a)综合解析,一文掌握所有要点!
- Chinese doctor Zhang Junqiao's heroic act exemplifies deep China-Africa friendship: FM spokesperson
- 用Python写了一个上课点名系统(附源码)(自制考勤系统)
- Kubernetes中的PV、PVC、Configmap介绍
- 标签列表
-
- ifneq (61)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)