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
助けてくれてありがとう!