Пытаюсь разобраться с кросскомпиляцией и удалённой отладкой на Gentoo.
Поставил crossdev, сконфигурировал тулчейн:
crossdev --ex-gdb -t arm-unknown-linux-gnueabihf
И на тестовом примере получается какая-то хрень:
user@japet ~/Temp/2 $ cat ./test1.c
/*
*
*/
#include <stdio.h>
int main( int argc, char** argv ){
printf("Hello World!\n");
return 0;
}
user@japet ~/Temp/2 $ arm-unknown-linux-gnueabihf-gcc -g -o ./test1 ./test1.c
user@japet ~/Temp/2 $ ls -l ./test1
-rwxr-xr-x 1 user user 6028 апр 21 06:20 ./test1
user@japet ~/Temp/2 $ scp -P 2200 test1 pi@rpi:/home/pi/tmp
test1 100% 6028 1.4MB/s 5.9KB/s 00:00
user@japet ~/Temp/2 $ arm-unknown-linux-gnueabihf-gdb ./test1
GNU gdb (Gentoo 7.12.1 vanilla) 7.12.1
Copyright (C) 2017 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 "--host=x86_64-pc-linux-gnu --target=arm-unknown-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
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"...
— — Loading Rust pretty-printers — —
Reading symbols from ./test1...done.
(gdb) target remote rpi:2345
Remote debugging using rpi:2345
warning: Can not parse XML target description; XML support was disabled at compile time
Reading symbols from /usr/arm-unknown-linux-gnueabihf/lib/ld-linux-armhf.so.3...(no debugging symbols found)...done.
Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030f3ffbe0000000040fdfcb610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0xb6fcfd40 in ?? () from /usr/arm-unknown-linux-gnueabihf/lib/ld-linux-armhf.so.3
(gdb) list
1 /*
2 *
3 */
4
5 #include <stdio.h>
6
7 int main( int argc, char** argv ){
8 printf("Hello World!\n");
9 return 0;
10 }
(gdb) break main
Breakpoint 1 at 0x10414: file ./test1.c, line 8.
(gdb) cont
Continuing.
Breakpoint 1, main (
argc=<error reading variable: Remote 'g' packet reply is too long: 0100000034f3ffbe3cf3ffbe000401000000000000000000d002010000000000000000000000000000f0ffb6dcf1ffbe0030fab6d0f1ffbe94e2e7b61404010010000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000>, argv=0xbefff334) at ./test1.c:8
8 printf("Hello World!\n");
(gdb) next
main (argc=1, argv=0xbefff334) at ./test1.c:8
8 printf("Hello World!\n");
Remote 'g' packet reply is too long: 0100000034f3ffbe3cf3ffbe000401000000000000000000d002010000000000000000000000000000f0ffb6dcf1ffbe0030fab6d0f1ffbe94e2e7b61404010010000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(gdb) cont
Continuing.
^CQuit
(gdb) quit
A debugging session is active.
Inferior 1 [process 7611] will be killed.
Quit anyway? (y or n) yes
Откуда вот этот «Remote 'g' packet reply is too long»?
И почему '(gdb) cont' не отрабатывает в конце, а зависает и приходиться обламывать по Ctrl+C?
На удалённой машине вообще ничего:
pi@raspberrypi:~/tmp $ ls -l
total 8
-rwxr-xr-x 1 pi pi 6028 Apr 21 06:22 test1
pi@raspberrypi:~/tmp $ gdbserver :2345 ./test1
Process ./test1 created; pid = 7611
Listening on port 2345
Remote debugging from host 192.168.34.198
GDBserver exiting