From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7164 invoked by alias); 11 Feb 2005 05:30:01 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 6955 invoked from network); 11 Feb 2005 05:29:41 -0000 Received: from unknown (HELO web30509.mail.mud.yahoo.com) (68.142.200.122) by sourceware.org with SMTP; 11 Feb 2005 05:29:41 -0000 Received: (qmail 99100 invoked by uid 60001); 11 Feb 2005 05:29:41 -0000 Message-ID: <20050211052941.99098.qmail@web30509.mail.mud.yahoo.com> Received: from [63.194.112.130] by web30509.mail.mud.yahoo.com via HTTP; Thu, 10 Feb 2005 21:29:41 PST Date: Fri, 11 Feb 2005 14:10:00 -0000 From: Tim Harvey Subject: Re: howto build gdb / gdbserver for x86 host with arm-linux target? To: Daniel Jacobowitz Cc: Anil Gunturu , gdb@sources.redhat.com In-Reply-To: <20050211042809.GA31483@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-02/txt/msg00075.txt.bz2 --- Daniel Jacobowitz wrote: > On Thu, Feb 10, 2005 at 08:04:03PM -0800, Tim Harvey wrote: > > > > --- Anil Gunturu 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 >