参考嵌入式VSCode+gdbserver图形化调试环境搭建与使用
参考VS Code + gdbserver 嵌入式arm远程调试
参考step by step 使用gdb调试Linux平台应用程序
一、软件准备
交叉编译软件gcc-linaro-5.4.1-2017.05-x86_64_arm-linux-gnueabihf,把gdbserver 复制到开发板上
./gdbserver 192.168.1.190:6666 /path/helloworld
192.168.1.190 开发主机的ip地址,6666 是端口,/path/helloworld 是需要调试运行的程序。
二、编译和调试
arm-linux-gnueabihf-gcc helloworld.c -o helloworld -g
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": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/helloworld",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"miDebuggerPath":"/opt/toolchain/gcc-linaro-5.4.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb",
"miDebuggerServerAddress": "192.168.1.145:6666"
}
]
}
①、name:调试的项目名
②、program:需要调试的应用程序可执行文件路径。
③、cwd:需要调试的应用程序源码路径。
④、miDebuggerPath:此项需要手动添加,用于指定所使用的交叉编译器 gdb路径。
⑤、miDebuggerServerAddress:此项需要手动添加,远程 gdbserver服务器地址,也就是开发板地址
三、在开发板上运行
./gdbserver 192.168.1.190:6666 /path/helloworld
在vscode 下打开helloworld.c 文件下按F5调试。文件断点,调试信息
调试过程的开发板输出
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
2014-12-12 rtsp协议详解
2014-12-12 自己动手写RTP服务器——传输所有格式的视频
2014-12-12 自己动手写RTP服务器——用RTP协议传输TS流
2014-12-12 自己动手写RTP服务器——关于RTP协议
2014-12-12 P2P直播、点播技术学习经验
2014-12-12 开源网络通信库参考
2014-12-12 一个P2P点播直播开源项目:P2PCenter