使用 gdbserver 远程调试 EV3 失败

问题描述

我正在为在基于 debian 的 ev3dev 上运行的 Lego EV3 编写 C++ 代码。为了编译它,我使用了一个带有 ev3dev 镜像的 docker 容器。 (与从 Windows 或 WSL 交叉编译相比,这是最好的工作方式)

为了调试我的代码,我想在 EV3 上创建一个 gdbserver,然后从我的笔记本电脑连接到它。因此,我编译了如下代码

arm-linux-gnueabi-g++ -g -o app ./app.cpp

然后我将二进制文件复制到 EV3 并在其上启动了一个 gdbserver:

gdbserver :8000 ./app

并从我的笔记本电脑连接到它:

gdb ./app
(gdb) target remote 192.168.137.3:8000

但是,我无法继续调试,而且由于我在交叉编译和远程调试方面经验不足,我不确定如何解决问题。

这是我笔记本电脑上的控制台输出

compiler@32a0a4440089:/src/EV3-testing/remote_debugger_test$ gdb ./app
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
copyright (C) 2016 Free Software Foundation,Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY,to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions,please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help,type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./app...done.
(gdb) target remote 192.168.137.3:8000
Remote debugging using 192.168.137.3:8000
warning: while parsing target description (at line 1): Target description specified unkNown architecture "arm"
warning: Could not load XML target description; ignoring
Reading /lib/ld-linux.so.3 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
warning: `target:/lib/ld-linux.so.3': Shared library architecture unkNown is not compatible with target architecture i386.
Reading /lib/ld-linux.so.3 from remote target...
warning: `target:/lib/ld-linux.so.3': Shared library architecture unkNown is not compatible with target architecture i386.
Reading symbols from target:/lib/ld-linux.so.3...Reading /lib/983c6fff2b6d7f46f59d77068be46be3852e81.debug from remote target...
Reading /lib/.debug/983c6fff2b6d7f46f59d77068be46be3852e81.debug from remote target...
(no debugging symbols found)...done.
0x00000000 in ?? ()
(gdb) b main
Breakpoint 1 at 0x400748: file ./app.cpp,line 18.
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 1: Remote connection closed

Command aborted.

这是 EV3 上的输出

robot@ev3dev:~$ gdbserver :8000 ./app
Process ./app created; pid = 1737
Listening on port 8000
Remote debugging from host 192.168.137.1
client_loop: send disconnect: Connection reset

感谢您的帮助!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)