This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


--- Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, Feb 10, 2005 at 08:04:03PM -0800, Tim Harvey wrote:
> > 
> > --- 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.
> 
> You're getting confused.  Don't specify CC to build GDB.  Do specify
> --target,
> however.  The error you got was from using an i386 targeted gdb with an
> ARM stub.
> 
> Do specify --host and CC to build gdbserver, but it sounds like you
> already have gdbserver.
> 

Is there an easy way to determine if your gdb and gdbserver is built correctly?
(see what stub (=target right?) its built with?)

So to build gdb with autodect host (x86) and arm-linux target:

$ cd gdb-6.3
$ ./configure --target=arm-linux
$ make
$ file gdb/gdb
gdb/gdb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
$ cd gdb/gdbserver
$ export CC=/usr/local/bin/arm-linux-gcc
$ ./configure --host=arm-linux
$ make
$ file gdbserver
gdbserver: ELF 32-bit MSB executable, ARM, version 1 (ARM), for GNU/Linux
2.4.3, dynamically linked (uses shared libs), not stripped

When trying to execute my app on the target with this gdbserver I get:

# gdbserver foo:1234 myApp
gdbserver: error while loading shared libraries: libthread_db.so.1: cannot open
shared object file: No such file or directory

My target's glibc doesn't have a libthread_db and I'm not really sure what this
even is vs libthread.

I don't know if the gdbserver that the snapgear-3.1.1 distro is building is
correct or not.  When I use it I get the 'Reply contains invalid hex digit 59'
error and I'm still not understanding if this is pointing to a problem with
gdbserver or the gdb host.

So to sum it up:  'host' refers to the architecture that it will execute on (in
my case x86 for gdb, arm-linux for gdbserver).  'target' refers to the
architecture that gdb will be debugging (in my case arm-linux).  And to
effectively cross-compile the gdbserver app I need to specify the
cross-compiler  with the exported var.

I can't understand why the toolchain I'm using doesn't simply include a
arm-linux-gdb already built... this would have really helped me out, but it
can't hurt to obtain a better knowledge of how to build it myself.

I appreciate the help and patience I'm getting on this list.  I cannot find
where this stuff is explained well.

Tim

> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]