DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

参考嵌入式gdb+gdbserver调试环境搭建与使用

参考嵌入式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调试。文件断点,调试信息

调试过程的开发板输出

 

 
posted on 2022-12-12 11:51  DoubleLi  阅读(321)  评论(0编辑  收藏  举报