vscode+aarch64+gdb+gdbserver 环境搭建

编译aarch64的gdb

下载gdb源代码:

http://ftp.gnu.org/gnu/gdb/

编译gdb(在x86上运行)

../configure --prefix=/maxvision/opt/gdb --host=x86_64-linux-gnu --target=arm-linux-gnueabi --disable-nls --without-doc

编译gdbserver(在目标机器下运行,编译的是静态链接版本)

../gdb/gdbserver/configure --prefix=/maxvision/opt/gdb-server/aarch64 --host=aarch64-linux-gnu --target=aarch64-linux-gnu LDFLAGS="-static"
../gdb/gdbserver/configure --prefix=/maxvision/opt/gdb-server/aarch64 --host=arm-linux-gnueabi --target=arm-linux-gnueabi LDFLAGS="-static"

编译完了开始使用

名称说明:

目标机器:最终程序运行的设备。

开发机器:编写代码,交叉编译机器。VSCODE运行的机器

目标机器运行

aarch64-linux-gnu-gdbserver 目标机IP:端口号 需要调试运行的程序

示例:aarch64-linux-gnu-gdbserver 172.31.50.110:60010 demo_test

配置开发机器(VSCODE):

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "程序在开发机器上的绝对路径包括文件名",
            "cwd": "程序的工作目录",
            "args": [],
            "stopAtEntry": false,
            "miDebuggerPath": "之前编译的gdb完整路径 /xxx/aarch64-linux-gnu-gdb",
            "miDebuggerServerAddress": "目标机器IP:端口 172.31.50.110:60010",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

其他:

开启coredump(仅在当前shell下有效) 

ulimit -c unlimited
echo "/coredumpdir//core.%e.%p" | sudo tee /proc/sys/kernel/core_pattern

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值