vscode+gdbserver 开发板调试

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

调试过程的开发板输出

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值