This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
How to configure gdb on arm-linux (for CDB89712)
- From: Dmytro Bablinyuk <dmytro dot bablinyuk at xtra dot co dot nz>
- To: gdb at sources dot redhat dot com
- Date: Fri, 07 Feb 2003 23:40:40 +1300
- Subject: How to configure gdb on arm-linux (for CDB89712)
I built arm-linux and put it on the board. Also I built a cross-compiler
(using uclibc)
I've done everything as described in
http://roland.seuhs.com/en/index.php/Development/LiMa/CDB89712
When I came to the point that I need to debug an application I got stuck
(hello world perfectly works on target as standalone application but not
with gdb).
I tried to build a cross-platform gdb and gdbserver. I tried below
steps to do this:
1.Unpack gdb
$cd $ARM_ROOT/src
$tar xzvf ../dl/gdb-5.3.tar.gz
Make symbolic link (easier for next steps if you don't have same
version)
$ln -s gdb-5.3 gdb
2. Build gdb
$cd $ARM_ROOT/src/gdb/
$./configure --host=i686-pc-linux-gnu --target=arm-linux
$make
$strip gdb/gdb
Check that we client for Intel platform:
[root@sardine gdb]# file gdb/gdb
gdb/gdb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), stripped
[root@sardine gdb]#
$cp gdb/gdb /usr/local/bin/arm-gdb
3. Build gdbserver
$cd $ARM_ROOT/src/gdb/gdb/gdbserver/
$chmod u+x configure
Remove cache file
$rm config.cache
$export CC=$ARM_ROOT/arm-linux-uclibc/bin/arm-uclibc-gcc
$./configure --target=arm-linux --host=arm-linux --build=i386-linux
$make clean
$make
Check output file
[root@sardine gdbserver]# file gdbserver
gdbserver: ELF 32-bit LSB executable, ARM, version 1 (ARM),
dynamically linked (uses shared libs), not stripped
[root@sardine gdbserver]#
Copy into the target's ramdisk
$cp gdbserver $ARM_ROOT/ramdisk/target/usr/bin/
As result I got a Illegal Instruction message when I started this up.
On host:
[Dmytro@sardine Dmytro]$ arm-gdb -nw
$ARM_ROOT/ramdisk/target/armdevelop/hello
GNU gdb 5.2.1
Copyright 2002 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 "--host=i686-pc-linux-gnu
--target=arm-linux"...
(gdb) target remote 172.25.193.23:1023
Remote debugging using 172.25.193.23:1023
0x00008110 in _start ()
(gdb) b main
Breakpoint 1 at 0x8158: file hello.c, line 4.
(gdb) c
Continuing.
Program received signal SIGILL, Illegal instruction.
0x00008114 in _start ()
(gdb)
On target(CDB89712)
# gdbserver 172.25.140.19:1023 /armdevelop/hello
Process /armdevelop/hello created; pid = 196
Remote debugging from host 172.25.140.19
hello(135): undefined instruction: pc=00008114
Code: e91ba800 e3a0b000 (e7ffdefe) e1a0100d e0812100
Killing inferior
#
And then
# tail /var/log/messages
Jan 1 05:53:56 name user.warn klogd: Code: e91ba800 e3a0b000
(e7ffdefe) e1a0100d e0812100
Jan 1 05:59:15 name syslog.info -- MARK --
Jan 1 06:19:15 name syslog.info -- MARK --
Jan 1 06:39:15 name syslog.info -- MARK --
Jan 1 06:59:15 name syslog.info -- MARK --
Jan 1 07:19:15 name syslog.info -- MARK --
Jan 1 07:20:31 name user.info klogd: hello (183): undefined
instruction: pc=00008114
Jan 1 07:20:31 name user.warn klogd: Code: e91ba800 e3a0b000
(e7ffdefe) e1a0100d e0812100
Jan 1 07:22:14 name user.info klogd: hello (185): undefined
instruction: pc=00008114
Jan 1 07:22:14 name user.warn klogd: Code: e91ba800 e3a0b000
(e7ffdefe) e1a0100d e0812100
#
Thanks in advance for any help,
Dmytro