This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

trace logs when program crash

I have two version firmware with different Kernel. The first one is come from SDK, Kernel is 3.0.21. The other is come from Yocto, Kernel is 3.4.

I write a simple program, access NULL pointer:
Quote:
int main()
{
char *nullptr = NULL;

sleep(1);
printf("write null ptr!\n");
*nullptr = 1;

while (1)
sleep(1);

return 0;
}
When running this program in 3.0.21 Kernel ,it will show trace logs, like:
Quote:
root@9615-cdp:/mnt/userrw# ./a.out &
root@9615-cdp:/mnt/userrw# write null ptr!
[ 578.949641] pgd = ce03c000
[ 578.953731] [00000000] *pgd=4e823831, *pte=00000000, *ppte=00000000
[ 578.959011] 
[ 578.963375] Pid: 1348, comm: a.out
[ 578.967098] CPU: 0 Not tainted (3.0.21+ #1)
[ 578.971677] PC is at 0x8400
[ 578.974393] LR is at 0xfbad2a84
[ 578.977506] pc : [<00008400>] lr : [<fbad2a84>] psr: 60000010
[ 578.977506] sp : bef48ce8 ip : 00000001 fp : bef48cf4
[ 578.989012] r10: 490cd000 r9 : 00000000 r8 : 00000000
[ 578.994201] r7 : 00000000 r6 : 000083d4 r5 : 491f6000 r4 : 491f7b78
[ 579.000671] r3 : 00000000 r2 : 00000001 r1 : fbad2a84 r0 : 00000010
[ 579.007141] Flags: nZCv IRQs on FIQs on Mode USER_32 ISA ARM Segment user
[ 579.014405] Control: 10c5387d Table: 4e83c059 DAC: 00000015
[ 579.020082] 
[ 579.020082] LR: 0xfbad2a04:
[ 579.024385] 2a04 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.032473] 2a24 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.040683] 2a44 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.048802] 2a64 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.056950] 2a84 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.065130] 2aa4 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.073279] 2ac4 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.081458] 2ae4 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.089607] 
[ 579.089607] R1: 0xfbad2a04:
[ 579.094307] 2a04 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.102029] 2a24 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.110178] 2a44 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.118327] 2a64 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.126506] 2a84 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.134655] 2aa4 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.142804] 2ac4 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.150984] 2ae4 ******** ******** ******** ******** ******** ******** ******** ********
[ 579.159194] [<c003d754>] (unwind_backtrace+0x0/0x12c) from [<c003ed00>] (__do_user_fault+0x54/0x9c)
[ 579.168228] [<c003ed00>] (__do_user_fault+0x54/0x9c) from [<c003eee4>] (do_page_fault+0x19c/0x1d8)
[ 579.177170] [<c003eee4>] (do_page_fault+0x19c/0x1d8) from [<c00321e8>] (do_DataAbort+0x34/0x98)
[ 579.185868] [<c00321e8>] (do_DataAbort+0x34/0x98) from [<c0037da0>] (ret_from_exception+0x0/0x10)
[ 579.194689] Exception stack(0xcebfbfb0 to 0xcebfbff8)
[ 579.199694] bfa0: 00000010 fbad2a84 00000001 00000000
[ 579.207904] bfc0: 491f7b78 491f6000 000083d4 00000000 00000000 00000000 490cd000 bef48cf4
[ 579.216053] bfe0: 00000001 bef48ce8 fbad2a84 00008400 60000010 ffffffff
But in 3.4 Kernel, it only show:
Segmentation fault

I want to make the 3.4 Kernel(come from Yocto) also show trace logs. 
Could anyone tell me how to do that?

Thanks a lot!