【发布时间】:2018-12-07 17:08:28
【问题描述】:
我正在尝试通过 vs 代码从 VM ubuntu 16.04 amd64 主机远程调试 c++ 应用程序到 cubietruck 板(ARM® Cortex™-A7 双核)的 debian armbian 目标。
我已经按照这个指南https://medium.com/@spe_/debugging-c-c-programs-remotely-using-visual-studio-code-and-gdbserver-559d3434fb78 只添加了字段
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
所以整个launch.json变成了
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"miDebuggerPath": "/home/user/ARM/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"program": "/home/user/myproject/bin/app",
"miDebuggerServerAddress": "localhost:9091",
"args": [],
"stopAtEntry": false,
"cwd": "/home/user/myproject",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "gdb"
},
"windows": {
"MIMode": "gdb"
}
}
]
}
在launch.json文件中以支持漂亮的打印机。
在主机中,我使用的是 linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf gdb,而 arm 板中的 gdb 具有本机 8.0.1 gdb。
一切正常,除了漂亮的打印机,因为字符串显示不正确。每当我将鼠标悬停在字符串上时,都会弹出 npos 和 _M_dataplus 字段,并且应该打开 _M_dataplus 字段以查看实际字符串。
在主机中,linaro gdb 支持漂亮的打印机,因为命令 info pretty-printer 给出了输出:
builtin
mpx_bound128
但是,当我在目标 gdb 8.0.1 中给出相同的命令时,我得到:
Undefined info command: "pretty-printer". Try "help info".
我还在我的主机主文件夹中创建了一个 .gdbinit 文件,其中包含 enable pretty-printer 命令。我在调试控制台中看到它执行成功,但结果也是错误的。
由于我是远程调试的新手,我应该怎么做才能让漂亮的打印机正常工作。我应该在远程板上也安装漂亮的打印机还是我做错了什么?
【问题讨论】:
标签: c++ visual-studio-code arm gdb remote-debugging