howto build gdb / gdbserver for x86 host with arm-linux target?

Tim Harvey
2005-02-11T02:12:03Z

I've got an XScale based board (arm-linux) that I need to do some remote
debugging on of a program called 'myApp' (note that this program does run fine
on the target, and is not stripped, so its compiled correctly). I'm using an
embedded linux distro that builds gdbserver for arm-linux and on my linux FC3
devel system I've got gdb 6.1 installed.

I'm doing the following:

XScale target:
# gdbserver foo:1234 myApp
Process myApp created; pid = 165
code at (nil) - (nil), data at (nil)

x86 FC3 Linux development host:
$ file romfs/bin/myApp
romfs/bin/myApp: ELF 32-bit MSB executable, ARM, version 1 (ARM), for GNU/Linux
2.0.0, dynamically linked (uses shared libs), not stripped
$ gdb romfs/bin/myApp
GNU gdb Red Hat Linux (6.1post-1.20040607.43rh)
Copyright 2004 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 "i386-redhat-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

(gdb) target remote 192.168.1.120:1234
Remote debugging using 192.168.1.120:1234
Couldn't establish connection to remote target
Reply contains invalid hex digit 59

on the Target I see:
Remote debugging using foo:1234
readchar: Got EOF
Remote side has terminated connection. GDBserver will reopen the connection.

What could the cause of the 'invalid hex digit 59' problem be?

Its been suggested that my gdb/gdbserver are not built correct so I downloaded
gdb 6.3 and would like to know how to build them appropriately for my
configuration.

If I do the following, gdbserver does not get built:

$ cd gdb-6.3
$ ./configure --target=arm-linux
$ make

This builds an x86 exe of gdb, but does not build gdbserver. Is this correct?
(host=i686 (autodetected), target=arm-linux). If I do the following to build
gdb server, it does not generate arm-linux exe:

$ cd gdb/gdbserver
$ ./configure --host=arm-linux --target=arm-linux
$ make

I'm I not understanding host and target? I would think that as I wish to
remote debug an app on an arm-linux target, from a x86 host that I would want
i686 host and arm-linux target for gdb, and arm-linux host and target for
gdbserver.

What am I doing wrong?

Thanks for any guidance,

Tim