public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* I have some problem on gdbserver
@ 2003-08-14 15:13 莉娟 刘
  2003-08-14 15:16 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: 莉娟 刘 @ 2003-08-14 15:13 UTC (permalink / raw)
  To: gdb

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 2657 bytes --]

Iwant to build cross-compile to my target, then I
build
gdbserver this way.  for example:
	$ export CC=my-cross-compiler(arm-linu-gcc)
	$ path-to-gdbserver-sources/configure
your-target-name(arm-linux)
	$ make
But when I run gdbserver:
         $ arm-linux-gcc -g -o filename filename.c
         $ ./gdbserver host:1234 filename
error:
bash:./gdbserver:cannot execute binary file.
Who can tell this is why?

I also buils according to BillGatliff,but the error is

same with above.
   First, make sure you have a functional arm-linux
toolchain built, and that it's in your search path.
Then, do this: 
[bgat@mars gnu] tar xzf gdb-5.2.tar.gz
[bgat@mars gnu] mkdir build-gdb && cd build-gdb
[bgat@mars build-gdb] ../gdb-5.2/configure
--target=arm-linux \ 
   --host=arm-linux --build=`../gdb-5.2/config.guess`
The backticks in the --build option cause the command
to run config.guess to figure out the identity of the
host machine. This may be pedantic, but it works for
me so I included it here. 
[bgat@mars build-gdb] cd gdb/gdbserver
[bgat@mars build-gdb] make CC=arm-linux-gcc
[bgat@mars build-gdb] file gdbserver
./gdbserver: ELF 32-bit LSB executable, ARM, version 1
(ARM), dynamically linked (uses shared libs), not
stripped
You probably don't want your gdbserver to use shared
libraries, unless your target environment supports
them (and you want to prove that they actually work!).
To save some hair, you'll probably want to build a
statically-linked gdbserver instead, so that you can
debug even if shared libraries are broken. To do that,
edit the Makefile in gdb/gdbserver, and modify
LDFLAGS: 
LDFLAGS = -static
There may be other LDFLAGS flags already there, which
you'll want to leave alone--- just add -static to the
end of the list. In other cases, LDFLAGS may not exist
at all; just add the above line somewhere near CFLAGS.

Then, rebuild gdbserver: 
[bgat@mars build-gdb] make clean
[bgat@mars build-gdb] make CC=arm-linux-gcc
[bgat@mars build-gdb] file gdbserver
gdbserver: ELF 32-bit LSB executable, ARM, version 1
(ARM), statically linked, not stripped
Run arm-linux-strip on the executable, if you want to
shrink it down: 
[bgat@mars build-gdb] arm-linux-strip gdbserver
[bgat@mars build-gdb] ls -l gdbserver
-rwxrwxr-x    1 bgat     bgat       249164 Aug  2
11:16 gdbserver
Now, before you forget: :^) 
[bgat@mars build-gdb] mv gdbserver arm-linux-gdbserver

regards!



_________________________________________________________
Do You Yahoo!? 
ÊîÆÚ´óƬÆë¾ÛÑÅ»¢Í¨ ÍøÂçÉãÏñÍ·+ÑÅ»¢Í¨µ÷ƵÊÕÒô»úµÈÄãÀ´ÄÃ
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.promo.yahoo.com/minisite/messenger1/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I have some problem on gdbserver
  2003-08-14 15:13 I have some problem on gdbserver 莉娟 刘
@ 2003-08-14 15:16 ` Daniel Jacobowitz
  2003-08-15  0:19   ` 莉娟 刘
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-08-14 15:16 UTC (permalink / raw)
  To: ???? ??; +Cc: gdb

On Thu, Aug 14, 2003 at 11:13:33PM +0800, ???? ?? wrote:
> Iwant to build cross-compile to my target, then I
> build
> gdbserver this way.  for example:
> 	$ export CC=my-cross-compiler(arm-linu-gcc)
> 	$ path-to-gdbserver-sources/configure
> your-target-name(arm-linux)
> 	$ make
> But when I run gdbserver:
>          $ arm-linux-gcc -g -o filename filename.c
>          $ ./gdbserver host:1234 filename
> error:
> bash:./gdbserver:cannot execute binary file.
> Who can tell this is why?

It looks like you are running gdbserver on the host.  It's supposed to
be run on the target.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I have some problem on gdbserver
  2003-08-14 15:16 ` Daniel Jacobowitz
@ 2003-08-15  0:19   ` 莉娟 刘
  2003-08-15  0:37     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: 莉娟 刘 @ 2003-08-15  0:19 UTC (permalink / raw)
  To: Daniel Jacobowitz, gdb

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 1372 bytes --]

 --- Daniel Jacobowitz <drow@mvista.com> µÄÕýÎÄ£º> On
Thu, Aug 14, 2003 at 11:13:33PM +0800, ???? ??
> wrote:
> > Iwant to build cross-compile to my target, then I
> > build
> > gdbserver this way.  for example:
> > 	$ export CC=my-cross-compiler(arm-linu-gcc)
> > 	$ path-to-gdbserver-sources/configure
> > your-target-name(arm-linux)
> > 	$ make
> > But when I run gdbserver:
> >          $ arm-linux-gcc -g -o filename filename.c
> >          $ ./gdbserver host:1234 filename
> > error:
> > bash:./gdbserver:cannot execute binary file.
> > Who can tell this is why?
> 
> It looks like you are running gdbserver on the host.
>  It's supposed to
> be run on the target.
> 
>
  Thank you very much.It is true,I run the cross-gdb
and gdbsever on the same host,but they cannot run on
the same host in the remote way?Does gdb support
communicating with target in TCP way on the same host?

(I know cross gdb can debug programs in "target sim"
way on the same host machine.)
  If I make gdbserver run on the target,must the
target be the machine with arm cpu ,or can it be cross
environment?
  regards!

_________________________________________________________
Do You Yahoo!? 
ÊîÆÚ´óƬÆë¾ÛÑÅ»¢Í¨ ÍøÂçÉãÏñÍ·+ÑÅ»¢Í¨µ÷ƵÊÕÒô»úµÈÄãÀ´ÄÃ
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.promo.yahoo.com/minisite/messenger1/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I have some problem on gdbserver
  2003-08-15  0:19   ` 莉娟 刘
@ 2003-08-15  0:37     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-08-15  0:37 UTC (permalink / raw)
  To: ???? ??; +Cc: gdb

On Fri, Aug 15, 2003 at 08:19:14AM +0800, ???? ?? wrote:
>  --- Daniel Jacobowitz <drow@mvista.com> ????????> On
> Thu, Aug 14, 2003 at 11:13:33PM +0800, ???? ??
> > wrote:
> > > Iwant to build cross-compile to my target, then I
> > > build
> > > gdbserver this way.  for example:
> > > 	$ export CC=my-cross-compiler(arm-linu-gcc)
> > > 	$ path-to-gdbserver-sources/configure
> > > your-target-name(arm-linux)
> > > 	$ make
> > > But when I run gdbserver:
> > >          $ arm-linux-gcc -g -o filename filename.c
> > >          $ ./gdbserver host:1234 filename
> > > error:
> > > bash:./gdbserver:cannot execute binary file.
> > > Who can tell this is why?
> > 
> > It looks like you are running gdbserver on the host.
> >  It's supposed to
> > be run on the target.
> > 
> >
>   Thank you very much.It is true,I run the cross-gdb
> and gdbsever on the same host,but they cannot run on
> the same host in the remote way?Does gdb support
> communicating with target in TCP way on the same host?
> 
> (I know cross gdb can debug programs in "target sim"
> way on the same host machine.)
>   If I make gdbserver run on the target,must the
> target be the machine with arm cpu ,or can it be cross
> environment?
>   regards!

Gdbserver the way you built it is an arm-linux binary.  Run it on an
arm-linux machine.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-08-15  0:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-14 15:13 I have some problem on gdbserver 莉娟 刘
2003-08-14 15:16 ` Daniel Jacobowitz
2003-08-15  0:19   ` 莉娟 刘
2003-08-15  0:37     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).