public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "莉娟 刘" <lljforever@yahoo.com.cn>
To: gdb@sources.redhat.com
Subject: I have some problem on gdbserver
Date: Thu, 14 Aug 2003 15:13:00 -0000	[thread overview]
Message-ID: <20030814151333.52605.qmail@web15306.mail.bjs.yahoo.com> (raw)

[-- 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/

             reply	other threads:[~2003-08-14 15:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-14 15:13 莉娟 刘 [this message]
2003-08-14 15:16 ` Daniel Jacobowitz
2003-08-15  0:19   ` 莉娟 刘
2003-08-15  0:37     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030814151333.52605.qmail@web15306.mail.bjs.yahoo.com \
    --to=lljforever@yahoo.com.cn \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).