I'm remotely-debugging an x86_64 executable on x86_64 target, but gdbserver seemingly reports debugging an i386 executable:
On the target:
# gdbserver --attach :9999 12345
Attached; pid = 12345
Listening on port 9999
On the host:
# gdb
<normal GDB banner>
(gdb) target remote 10.0.0.1:9999
Remote debugging using 10.0.0.1:9999
0x773660d8 in ?? ()
(gdb) show architecture
The target architecture is set automatically (currently i386)
Is it gdb (at the host) or gdbserver (at the target), who determines the architecture wrongly? Why could this happen, and how to fix it?
TIA for any insights.