Reputation: 1364
I try to use remotely the gdbserver for debug as follows
Start the gdbserver on target machine
$ gdbserver localhost:2000 hello -l 20 -b 10 --enable-targets=all
Host machine has the program binary with debugging enabled
"copied binary from ARM target to host"
Run gdb on host machine
$ gdb -q --args hello --enable-target=all
Connect to the target
(gdb) target remote 192.168.15.132
192.168.15.132: No such file or directory.
(gdb) target remote 192.168.15.132:2000
Remote debugging using 192.168.15.132:2000
warning: while parsing target description (at line 11): Target description specified unknown architecture "aarch64"
warning: Could not load XML target description; ignoring
Remote register badly formatted: T051d:0000000000000000;1f:80fcffffffff0000;20:403cfdb7ffff0000;thread:pd60.d60;core:1;
here: 00000000;1f:80fcffffffff0000;20:403cfdb7ffff0000;thread:pd60.d60;core:1;
(gdb) q
I am looking for an advice to correctly debug with ARM remote target.
Upvotes: 10
Views: 16743
Reputation: 5925
Since you are reporting that your GDB supports the following architectures:
i386:x64-32 i386:x86-64:intel i386 i386:x64-32:intel i386:x86-64:nacl i386:intel i386:x64-32:nacl i8086 i386:nacl i386:x86-64
, you may be attempting to remotely debug an aarch64-linux-gnu executable using an x86_64-targeted version of gdb.I would suggest to download/install gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz:
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
tar Jxvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz -C /opt
and then use /opt/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gdb
for remotely debugging your program.
Upvotes: 1
Reputation: 368
To debug executables compiled for a different architecture, install gdb-multiarch
and run gdb-multiarch
instead of gdb
. Different distributions compile gdb differently and some even lack the multiarch version in their repositories - RHEL doesn't include it, but it's present in Ubuntu and Debian.
Upvotes: 27