* Re: howto build gdb / gdbserver for x86 host with arm-linux target?
[not found] <20050211024733.30134.qmail@web30706.mail.mud.yahoo.com>
@ 2005-02-11 4:28 ` Tim Harvey
2005-02-11 5:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2005-02-11 4:28 UTC (permalink / raw)
To: Anil Gunturu, gdb
--- 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: howto build gdb / gdbserver for x86 host with arm-linux target?
2005-02-11 4:28 ` howto build gdb / gdbserver for x86 host with arm-linux target? Tim Harvey
@ 2005-02-11 5:30 ` Daniel Jacobowitz
2005-02-11 14:10 ` Tim Harvey
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2005-02-11 5:30 UTC (permalink / raw)
To: Tim Harvey; +Cc: Anil Gunturu, gdb
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.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: howto build gdb / gdbserver for x86 host with arm-linux target?
2005-02-11 5:30 ` Daniel Jacobowitz
@ 2005-02-11 14:10 ` Tim Harvey
2005-02-11 15:45 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2005-02-11 14:10 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Anil Gunturu, gdb
--- 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: howto build gdb / gdbserver for x86 host with arm-linux target?
2005-02-11 14:10 ` Tim Harvey
@ 2005-02-11 15:45 ` Daniel Jacobowitz
2005-02-11 18:37 ` Tim Harvey
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2005-02-11 15:45 UTC (permalink / raw)
To: Tim Harvey; +Cc: Anil Gunturu, gdb
On Thu, Feb 10, 2005 at 09:29:41PM -0800, Tim Harvey wrote:
> $ 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.
There's one in your cross development environment or gdbserver wouldn't
have even built.
You have to use the same libraries in your cross environment and on
your target if you want things to work...
> 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.
Are you using it with the arm-linux-gdb you built above? In your first
message you were using your host GDB.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: howto build gdb / gdbserver for x86 host with arm-linux target?
2005-02-11 15:45 ` Daniel Jacobowitz
@ 2005-02-11 18:37 ` Tim Harvey
2005-02-12 2:53 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2005-02-11 18:37 UTC (permalink / raw)
To: Daniel Jacobowitz, gdb
--- Daniel Jacobowitz <drow@false.org> wrote:
> On Thu, Feb 10, 2005 at 09:29:41PM -0800, Tim Harvey wrote:
> > $ 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.
>
> There's one in your cross development environment or gdbserver wouldn't
> have even built.
>
> You have to use the same libraries in your cross environment and on
> your target if you want things to work...
Ok, I see the light. I put libthread_db on my target and now my new gdbserver
runs and I 'can' remote debug with my resulting new arm-linux-gdb and
arm-linux-gdbserver.
>
> > 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.
>
> Are you using it with the arm-linux-gdb you built above? In your first
> message you were using your host GDB.
>
The way I understand it is that I have to use my arm-linux-gdb as my host gdb
has stubs for the host architecture not the target (right?)
I think I understand this now. Obviously something was/is wrong with the
gdbserver being built from my snapgear distro as the one I build from gdb6.3
works.
Thanks for your help!
Tim
> --
> Daniel Jacobowitz
> CodeSourcery, LLC
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: howto build gdb / gdbserver for x86 host with arm-linux target?
2005-02-11 18:37 ` Tim Harvey
@ 2005-02-12 2:53 ` Daniel Jacobowitz
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2005-02-12 2:53 UTC (permalink / raw)
To: Tim Harvey; +Cc: gdb
On Fri, Feb 11, 2005 at 10:34:41AM -0800, Tim Harvey wrote:
> The way I understand it is that I have to use my arm-linux-gdb as my host gdb
> has stubs for the host architecture not the target (right?)
The "stub" in this case is gdbserver - the name's historic. Your host
GDB is configured for your host architecture, and to use a remote stub
the GDB client has to be configured for the same architecture as the
stub. So, basically right.
> Thanks for your help!
No problem.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 7+ messages in thread
* howto build gdb / gdbserver for x86 host with arm-linux target?
@ 2005-02-11 4:04 Tim Harvey
0 siblings, 0 replies; 7+ messages in thread
From: Tim Harvey @ 2005-02-11 4:04 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-02-11 18:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20050211024733.30134.qmail@web30706.mail.mud.yahoo.com>
2005-02-11 4:28 ` howto build gdb / gdbserver for x86 host with arm-linux target? Tim Harvey
2005-02-11 5:30 ` Daniel Jacobowitz
2005-02-11 14:10 ` Tim Harvey
2005-02-11 15:45 ` Daniel Jacobowitz
2005-02-11 18:37 ` Tim Harvey
2005-02-12 2:53 ` Daniel Jacobowitz
2005-02-11 4:04 Tim Harvey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox