Problems with gdbserver

Phil Edworthy Phil.Edworthy at renesas.com
Thu Sep 30 15:35:55 UTC 2010


Hi,

I am using the CodeSourcery SH 4.4-200 Lite toolchain with Buildroot (glibc)
for an SH4 device (SH7724). I want to use remote gdb so I followed the
instructions in your doc. 


The app in this example is a simple Hello World and runs fine on its own. It
was built with:
$ sh-linux-gnu-gcc -o menu -g main.c
$ sudo cp menu /tftpboot/rootfs/root/


Copy over the sysroot:
$ sudo cp -rf /usr/share/renesas-4.4/sh-linux-gnu/libc/sbin /tftpboot/rootfs
$ sudo cp -rf /usr/share/renesas-4.4/sh-linux-gnu/libc/lib /tftpboot/rootfs
$ sudo cp -rf /usr/share/renesas-4.4/sh-linux-gnu/libc/usr /tftpboot/rootfs
$ sudo cp -rf /usr/share/renesas-4.4/sh-linux-gnu/libc/etc /tftpboot/rootfs


Start gdbserver on the target:
$ gdbserver :2345 ./menu


Run gdb on the host:
$ sh-linux-gnu-gdb /tftpboot/rootfs/root/menu
GNU gdb (Sourcery G++ Lite 4.4-200) 7.0.50.20100218-cvs
<snip>
Reading symbols from /tftpboot/rootfs/root/menu...done.
(gdb) set sysroot /tftpboot/rootfs/
(gdb) target remote 192.168.10.31:2345
Remote debugging using 192.168.10.31:2345
Reading symbols from /tftpboot/rootfs/lib/ld-linux.so.2...(no debugging
symbols found)...done.
Loaded symbols for /tftpboot/rootfs/lib/ld-linux.so.2
Got object file from memory but can't read symbols: File format not
recognized.
0x295568c0 in _start () from /tftpboot/rootfs/lib/ld-linux.so.2
(gdb) b main
Breakpoint 1 at 0x4004b4: file main.cpp, line 7.
(gdb) c
Continuing.
Remote connection closed
(gdb)


The host connects to the target fine and sets the breakpoint. However, when
Continuing, gdbserver segfaults:
Process ./menu created; pid = 610
Listening on port 2345
Remote debugging from host 192.168.10.30
Unable to handle kernel NULL pointer dereference at virtual address 00000084
pc = 88004260
*pde = 8f197000
Oops: 0001 [#18]
last sysfs file: /sys/class/vc/vcs3/dev
Modules linked in:

Pid : 607, Comm:                gdbserver
CPU : 0                 Tainted: G      D      (2.6.35 #1)

PC  : 88004260 SP  : 8f1e1f88 SR  : 40008100 TEA : 296608c0
R0  : 00000000 R1  : 00000000 R2  : 00000000 R3  : fffffffc
R4  : 8f0676c0 R5  : 00000006 R6  : 00000084 R7  : 00000000
R8  : 8f0676c0 R9  : 00000006 R10 : 00000000 R11 : 000000e0
R12 : 00000000 R13 : 00000004 R14 : 7bf21a40
MACH: 00000004 MACL: 5c405562 GBR : 296f5470 PR  : 8801dabc

Call trace:
 [<8801dabc>] 0x8801dabc
 [<8800725a>] 0x8800725a
 [<8801da20>] 0x8801da20

Process: gdbserver (pid: 607, stack limit = 8f1e0001)
Stack: (0x8f1e1f88 to 0x8f1e2000)
1f80:                   8801dabc 8800725a 296f17cc 00000000 00000071
00000100
1fa0: 8801da20 7bf21a90 00000006 00000002 0000001a 00000006 00000262
000000e0
1fc0: 00000000 00000000 0042a2cc 296f5480 00000017 296f17cc 00000004
7bf21a40
1fe0: 7bf21a40 2966c778 00413944 00008101 296f5470 00000004 00000000
00000050
---[ end trace b2f2a75ed511a0bb ]---
Segmentation fault


Any ideas what could be wrong?

Thanks
Phil



More information about the superh-gnu-discuss mailing list