2008-08-21 13:47:44 debugging advise needed (uClinux-dist-2008R1-RC8 on BF537 STAMP)
dee lock (SINGAPORE)
Message: 60856
hi all.
I am cross compiling a program (PDa: a clone of the computer music system Pure Data that runs on Personal Digital Assistants) to blackfin BF537 STAMP running uClinux-dist-2008R1. PDa is known to work on various uclinux platforms and the developer is confident it should run on blackfin uclinux.
When I compile and target the development host, it works.
When i compile for target blackfin, and run it from the stamp board, the program crashes (output appended below).
I attempted using the gdbserver to debug (for the first time), but gdbserver simply reports "program exited with code 01". I'd appreciate some advise on either the crash data or perhaps a better way to debug the programme.
Cheers!
root: /> /bin/pd -noaudio -nomidi -nogui /random.pd
setup
CoNULL pointer access (d:probably)
Defered Exception context
CURRENT PROCESS:
COMM=pd PID=150
TEXT = 0x00e00040-0x00e80220 DATA = 0x00e80224-0x00ef4304
BSS = 0x00ef4304-0x00f1f294 USER-STACK = 0x00f20f50
return address: [0x00e003f6]; contents of:
0x00e003d0: e100 0280 e301 b3f4 200e acba a290 b0b8
0x00e003e0: a0b8 0c00 1008 e140 00e8 e100 0290 a0b9
0x00e003f0: e301 b3e6 acba [e410] 0025 0c00 1bef 0000
0x00e00400: acba e410 0025 e801 0000 0010 e800 0007
SEQUENCER STATUS: Not tainted
SEQSTAT: 00062027 IPEND: 0030 SYSCFG: 0006
HWERRCAUSE: 0x18
EXCAUSE : 0x27
RETE: <0x00000000> /* Maybe null pointer? */
RETN: <0x00c50000> /* unknown address */
RETX: <0x00e003f6> [ pd + 0x3b6 ]
RETS: <0x00e003f4> [ pd + 0x3b4 ]
PC : <0x00e003f6> [ pd + 0x3b6 ]
DCPLB_FAULT_ADDR: <0x00000094> /* Maybe null pointer? */
ICPLB_FAULT_ADDR: <0x00e003f6> [ pd + 0x3b6 ]
PROCESSOR STATE:
R0 : 0000000a R1 : 00000001 R2 : 00000000 R3 : 00000001
R4 : 00e37778 R5 : 00000005 R6 : 00f16cf0 R7 : 00000078
P0 : 00ef4124 P1 : 00000000 P2 : 00000000 P3 : 00f20f54
P4 : 00ef4300 P5 : 00f1fe4c FP : 00f1f788 SP : 00c4ff24
LB0: 00e774a1 LT0: 00e774a0 LC0: 00000000
LB1: 00e765a5 LT1: 00e765a4 LC1: 00000000
B0 : 00f1efc0 L0 : 00000000 M0 : 00000000 I0 : 00000008
B1 : 00000007 L1 : 00000000 M1 : 00000000 I1 : 00000000
B2 : 00000000 L2 : 00000000 M2 : 00000000 I2 : 10000000
B3 : 00000000 L3 : 00000000 M3 : 00000000 I3 : 00000000
A0.w: 00000000 A0.x: 00000000 A1.w: 00000000 A1.x: 00000000
USP : 00f1f77c ASTAT: 02003025
Hardware Trace:
0 Target : <0x0000483c> { _trap_c + 0x0 }
Source : <0xffa0076c> { _exception_to_level5 + 0xb4 }
1 Target : <0xffa006b8> { _exception_to_level5 + 0x0 }
Source : <0xffa00614> { _ex_trap_c + 0x5c }
2 Target : <0xffa005b8> { _ex_trap_c + 0x0 }
Source : <0xffa00442> { _ex_workaround_261 + 0x22 }
3 Target : <0xffa00420> { _ex_workaround_261 + 0x0 }
Source : <0xffa0080c> { _trap + 0x28 }
4 Target : <0xffa007e4> { _trap + 0x0 }
Source : <0x00e003f4> [ pd + 0x3b4 ]
5 Target : <0x00e003f4> [ pd + 0x3b4 ]
Source : <0x00e36c98> [ pd + 0x36c58 ]
6 Target : <0x00e36c92> [ pd + 0x36c52 ]
Source : <0x00e76d0c> [ pd + 0x76ccc ]
7 Target : <0x00e76d04> [ pd + 0x76cc4 ]
Source : <0x00e7051c> [ pd + 0x704dc ]
8 Target : <0x00e70516> [ pd + 0x704d6 ]
Source : <0x00e70504> [ pd + 0x704c4 ]
9 Target : <0x00e704f2> [ pd + 0x704b2 ]
Source : <0x00e704c4> [ pd + 0x70484 ]
10 Target : <0x00e704c4> [ pd + 0x70484 ]
Source : <0x00e6ddbe> [ pd + 0x6dd7e ]
11 Target : <0x00e6ddb8> [ pd + 0x6dd78 ]
Source : <0x00e6deba> [ pd + 0x6de7a ]
12 Target : <0x00e6deb8> [ pd + 0x6de78 ]
Source : <0x00e6ec5e> [ pd + 0x6ec1e ]
13 Target : <0x00e6ec52> [ pd + 0x6ec12 ]
Source : <0x00000428> /* Maybe fixed code section */
14 Target : <0x00000420> /* Maybe fixed code section */
Source : <0x00e6ec50> [ pd + 0x6ec10 ]
15 Target : <0x00e6ec4c> [ pd + 0x6ec0c ]
Source : <0x00e6ebf4> [ pd + 0x6ebb4 ]
Stack from 00c4ff04:
00000000 ffa00770 00144570 00144570 00144568 00000001 00ef40dc 00e756fa
00e003f6 00000030 00062027 00000000 00c50000 00e003f6 00e003f6 00e003f4
0000000a 02003025 00e765a5 00e774a1 00e765a4 00e774a0 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000007 00f1efc0
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 10000000 00000000 00000008 00f1f77c 00f1f788 00f1fe4c 00ef4300
Call Trace:
t_canvasenvironment
SIGSEGV
QuoteReplyEditDelete
2008-08-21 13:57:02 Re: debugging advise needed (uClinux-dist-2008R1-RC8 on BF537 STAMP)
Mike Frysinger (UNITED STATES)
Message: 60857
the documentation explains how to debug traces:
http://docs.blackfin.uclinux.org/doku.php?id=debuging_applications#analyzing_traces
it also tells you how to use gdbserver:
http://docs.blackfin.uclinux.org/doku.php?id=debuggers
QuoteReplyEditDelete
2008-08-24 21:23:20 Re: debugging advise needed (uClinux-dist-2008R1-RC8 on BF537 STAMP)
Robin Getz (UNITED STATES)
Message: 60956
Damien:
Null pointer accesses are a sure sign of something bad. (it will not run on any MMU system either).
It could however, run with mistakes on other noMMU platforms - compile it for x86, and I would think it will fail the same way.
-Robin
QuoteReplyEditDelete
2008-08-27 12:40:03 Re: debugging advise needed (uClinux-dist-2008R1-RC8 on BF537 STAMP)
dee lock (SINGAPORE)
Message: 61182
Hi all
The Program compiles without error on my development host (X86), and other several other uClinux platforms. (gumstix, maemo etc).
Here is the output of gdb now I have compiled with -g flags. I am not sure how to start interpreting the data. I'd appreciate any advise you have to offer on how to progress from here. I extracted the notable errors below, and attached the full gdb session to this post.
Thanks for your advise and words of encouragement. Really appreciated.
best regards,
-damien.
-----------------------
calloc (nmemb=12, lsize=1) at libc/stdlib/malloc/calloc.c:34
34 libc/stdlib/malloc/calloc.c: No such file or directory.
__udivsi3 ()
at /usr/src/packages/BUILD/blackfin-toolchain-uclibc-full-08r1.5/../gcc-4.1/gcc/config/bfin/lib1funcs.asm:89
89 /usr/src/packages/BUILD/blackfin-toolchain-uclibc-full-08r1.5/../gcc-4.1/gcc/config/bfin/lib1funcs.asm: No such file or directory.
pthread_mutex_lock (mutex=0x6ec90c) at libpthread/linuxthreads.old/forward.c:125
125 libpthread/linuxthreads.old/forward.c: No such file or directory.
in libpthread/linuxthreads.old/forward.c
s__pthread_lock (lock=0x6ec91c, self=0x0) at libpthread/linuxthreads.old/spinlock.c:66
66 libpthread/linuxthreads.old/spinlock.c: No such file or directory.
in libpthread/linuxthreads.old/spinlock.c
__heap_alloc (heap=<value optimized out>, size=<value optimized out>)
at libc/stdlib/malloc/heap_alloc.c:29
29 libc/stdlib/malloc/heap_alloc.c: No such file or directory.
in libc/stdlib/malloc/heap_alloc.c
spthread_mutex_unlock (mutex=0x6ec90c) at libpthread/linuxthreads.old/forward.c:131
131 libpthread/linuxthreads.old/forward.c: No such file or directory.
in libpthread/linuxthreads.old/forward.c
memset () at libc/string/bfin/memset.S:28
28 libc/string/bfin/memset.S: No such file or directory.
in libc/string/bfin/memset.S
Current language: auto; currently asm
29 in libc/string/bfin/memset.S
...
Program received signal SIGSEGV, Segmentation fault.
0x0050a060 in canvas_getenv (x=0x0) at g_canvas.c:169
169 while (!x->gl_env)
Current language: auto; currently c
PDa_gdbSession27082008.txt
QuoteReplyEditDelete
2008-08-28 22:12:24 Re: debugging advise needed (uClinux-dist-2008R1-RC8 on BF537 STAMP)
Robin Getz (UNITED STATES)
Message: 61294
Damien:
Umm -- you posted the following:
Program received signal SIGSEGV, Segmentation fault.
0x0050a060 in canvas_getenv (x=0x0) at g_canvas.c:169
169 while (!x->gl_env)
Current language: auto; currently c
(gdb
You can see the fuction that you called - with parameters (x=0), then you are deferencing that pointer. I would not expect that to work. That will not work on any other architecture either. (You are not checking to see if x is zero before it is dereferenced is just bad practice...)
Determining why x is zero is up to you.
-Robin