I tried to remote debug an 32-bit application on x86_64 suse linux, but get this "remote register badly formatted" error.
I start up the gdbserver as listening on port 12345 (gdbserver localhost:12345 my_prog)
And this is the error:
$ gdb
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
(gdb) target remote <ip>:12345
Remote debugging using <ip>:12345
Remote register badly formatted: T0506:0000000000000000;07:80b8bcff00000000;10:4028f0f700000000;
here: 0000000;07:80b8bcff00000000;10:4028f0f700000000;
(gdb)
This is the debug server machine (uname -a):
Linux server 2.6.16.60-0.31-smp #1 SMP Tue Oct 7 16:16:29 UTC 2008 x86_64 x86_64 x86_64 GNU/Linux
And this is the debug client machine (uname -a):
Linux client 2.6.16.54-0.2.5-default #1 Mon Jan 21 13:29:51 UTC 2008 x86_64 x86_64 x86_64 GNU/Linux
Both machines are running in virtual machines though (VMWare). The gdbserver binary is copied from the client machine to the server machine.
(I remote debug because the runtime environment on the debug server is production-like, and doesn't contain any development tools, access to the source code etc.)
Any suggestions are welcome.
UPDATE: this worked for me by issuing the following command in gdb:
set architecture i386:x86-64
gdb-multiarch. GDB is a source-level debugger, capable of breaking programs at any specific line, displaying variable values, and determining where errors occurred. Currently, gdb supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, Go, and Ada. A must-have for any serious programmer.
To start remote debugging, run GDB on the host machine, and specify as an executable file the program that is running in the remote machine. This tells GDB how to find your program's symbols and the contents of its pure text. Start GDB on the host, and connect to the target (see section Connecting to a remote target).
Perhaps you need to execute something like set architecture i386
at the (gdb)
prompt? What does show architecture
say after you connect to the remote target?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With