I'm trying remote debug a Rust executable using gdbserver
on the remote machine and gdb
on the local machine. I set up a Vagrant VM (bento/ubuntu-18.04) and start a gdbserver
:
$ vagrant ssh
$ uname -a
Linux dev 4.15.0-121-generic #123-Ubuntu SMP Mon Oct 5 16:16:40 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ gdbserver --version
GNU gdbserver (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
gdbserver is free software, covered by the GNU General Public License.
This gdbserver was configured as "x86_64-linux-gnu"
$ cargo run
$ file ./target/debug/my-app
./target/debug/my-app: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=31b1870cf7ef9e35ebe980acedf7eeaad694bb60, with debug_info, not stripped
$ gdbserver localhost:2000 ./target/debug/my-app
Process ./target/debug/my-app created; pid = 3851
Listening on port 2000
On my local macOS workstation:
$ uname -a
Darwin XXX 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64
$ gdb
GNU gdb (GDB) 10.1
Copyright (C) 2020 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-apple-darwin19.6.0".
Type "show configuration" for configuration details.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) target remote localhost:2000
Remote debugging using localhost:2000
Reading /vagrant/target/debug/my-app from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /vagrant/target/debug/my-app from remote target...
Reading symbols from target:/vagrant/target/debug/my-app...
warning: I'm sorry, Dave, I can't do that. Symbol format `elf64-x86-64' unknown.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading symbols from target:/lib64/ld-linux-x86-64.so.2...
Error while reading shared library symbols for target:/lib64/ld-linux-x86-64.so.2:
I'm sorry, Dave, I can't do that. Symbol format `elf64-x86-64' unknown.
[1] 16617 abort gdb
What is going wrong here?