howto build gdb / gdbserver for x86 host with arm-linux target?
Tim Harvey
tim_harvey@yahoo.com
Fri Feb 11 04:28:00 GMT 2005
--- Anil Gunturu <anil_gunturu@yahoo.com> wrote:
> You don't need symbols on the target when running gdbserver. So it's ok to
> strip the symbols.
right, I realize that the exe on the target can be stripped, but a non-stripped
version will need to exist on the host and I assume it can't hurt to have the
target version non stripped as well right?
> You need to export the arm-gcc before running ./configure. For example:
> export CC=${arm-compiler-path}/arm-gcc
> configure --target=arm-linux.
> -Anil
Ah, so basically autoconf doesn't handle cross compiling and you always need to
specify the compiler manually.
Now I'm running into the following error:
[gdb-6.3]$ export CC=/usr/local/bin/arm-linux-gcc
[gdb-6.3]$ ./configure --target=arm-linux
creating cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking target system type... arm-unknown-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... /usr/local/bin/arm-linux-gcc
checking whether the C compiler (/usr/local/bin/arm-linux-gcc ) works... yes
checking whether the C compiler (/usr/local/bin/arm-linux-gcc ) is a
cross-compiler... yes
checking whether we are using GNU C... yes
checking whether /usr/local/bin/arm-linux-gcc accepts -g... yes
checking for gnatbind... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1
$$f2
checking for correct version of gmp.h... no
checking for bison... bison
checking for bison... bison -y
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for i686-pc-linux-gnu-ar... no
checking for ar... ar
checking for i686-pc-linux-gnu-as... no
checking for as... as
checking for i686-pc-linux-gnu-dlltool... no
checking for dlltool... dlltool
checking for i686-pc-linux-gnu-ld...
/usr/local/lib/gcc-lib/arm-linux/3.3.3/../../../../arm-linux/bin/ld
checking for i686-pc-linux-gnu-nm... no
checking for nm... nm
checking for i686-pc-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking for i686-pc-linux-gnu-windres... no
checking for windres... windres
checking for i686-pc-linux-gnu-objcopy... no
checking for objcopy... objcopy
checking for i686-pc-linux-gnu-objdump... no
checking for objdump... objdump
checking for arm-linux-ar... arm-linux-ar
checking for arm-linux-as... arm-linux-as
checking for arm-linux-dlltool... no
checking for arm-linux-ld... arm-linux-ld
checking for arm-linux-nm... arm-linux-nm
checking for arm-linux-ranlib... arm-linux-ranlib
checking for arm-linux-windres... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking if symbolic links between directories work... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
[gdb-6.3]$ make
Configuring in libiberty
configure: creating cache ./config.cache
checking whether to enable maintainer-specific portions of Makefiles... no
checking for makeinfo... makeinfo
checking for perl... perl
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for i686-pc-linux-gnu-ar... ar
checking for i686-pc-linux-gnu-ranlib... ranlib
checking for i686-pc-linux-gnu-gcc... /usr/local/bin/arm-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C
compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make: *** [configure-libiberty] Error 1
I'm not sure why I would ever change 'host' as the host that gdb will be
running on will be x86 right? Althought 'host' for gdbserver will need to be
arm-linux right? I'm still a bit confused.
Tim
>
> Tim Harvey <tim_harvey@yahoo.com> wrote:
> 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
>
>
> ---------------------------------
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
More information about the Gdb
mailing list