vscode单步调试Android c++源码
2021/6/5 12:21:05
本文主要是介绍vscode单步调试Android c++源码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
目录- 步骤
- 1. 运行gdbclient.py脚本
- 2. 复制生成的launch.json并新建/home/jetson/android_aosp/aosp/.vscode/launch.json
- 3. 运行gdb即可,打断点
- 参考
步骤
注意:这个过程需要在Android源码环境中运行,可以使用adb端口转发工具,来连接服务器端的源码进行运行
关于adb端口转发:请看https://www.cnblogs.com/pyjetson/p/14828485.html
1. 运行gdbclient.py脚本
首先是使用vscode remote ssh终端连接服务器 1. 找到进程的pid号 adb shell "ps -A | grep vold" 2. 运行gdbclient.py脚本 gdbclient.py -p 20750 --setup-forwarding vscode
2. 复制生成的launch.json并新建/home/jetson/android_aosp/aosp/.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "miDebuggerPath": "/home/jetson/android_aosp/aosp/prebuilts/gdb/linux-x86/bin/gdb", "program": "/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/system/bin/vold", "setupCommands": [ { "text": "-enable-pretty-printing", "description": "Enable pretty-printing for gdb", "ignoreFailures": true }, { "text": "-environment-directory /home/jetson/android_aosp/aosp", "description": "gdb command: dir", "ignoreFailures": false }, { "text": "-gdb-set solib-search-path /home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/system/lib/:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/system/lib/hw:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/system/lib/ssl/engines:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/system/lib/drm:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/system/lib/egl:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/system/lib/soundfx:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/vendor/lib/:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/vendor/lib/hw:/home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols/vendor/lib/egl", "description": "gdb command: set solib-search-path", "ignoreFailures": false }, { "text": "-gdb-set solib-absolute-prefix /home/jetson/android_aosp/aosp/out/target/product/generic_x86/symbols", "description": "gdb command: set solib-absolute-prefix", "ignoreFailures": false }, { "text": "-interpreter-exec console \"source /home/jetson/android_aosp/aosp/development/scripts/gdb/dalvik.gdb\"", "description": "gdb command: source art commands", "ignoreFailures": false } ], "name": "(gdbclient.py) Attach vold (port: 5039)", "miDebuggerServerAddress": "localhost:5039", "request": "launch", "type": "cppdbg", "cwd": "/home/jetson/android_aosp/aosp", "MIMode": "gdb" } ] }
3. 运行gdb即可,打断点
参考
1. 使用调试程序 https://source.android.com/devices/tech/debug/gdb
这篇关于vscode单步调试Android c++源码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享