Text Link Ads

Wednesday, September 26, 2007

Tip for the day: GETTING MORE FROM SIGSEGV

For those who want to get more info on SIGSEGV for your application in Linux, you can use the following command "catchsegv".

for eg: consider the program (a.c)
main()
{
char *p = 0;
*p = 'a';
}

$cc a.c
$catchsegv a.out #produces the following output


*** Segmentation fault
Register dump:
EAX: 00000000 EBX: 4010e1ec ECX: 08048398 EDX: 4010f098
ESI: 4000ae60 EDI: bffffafc EBP: bffffab0 ESP: bffffaac

EIP: 080483a8 EFLAGS: 00010296

CS: 0023 DS: 002b ES: 002b FS: 0000 GS: 0000 SS: 002b

Trap: 0000000e Error: 00000006 OldMask: 00000000
ESP/signal: bffffaac CR2: 00000000

FPUCW: ffff037f FPUSW: ffff0000 TAG: ffffffff
IPOFF: 00000000 CSSEL: 0000 DATAOFF: 0000ffff DATASEL:
0000

ST(0) 0000 0000000000000000 ST(1) 0000 cf118de5ab2a5800
ST(2) 0000 feb02a6c405d9ad4 ST(3) 0000 0000000000000000
ST(4) 0000 8000000000000000 ST(5) 0000 8000000000000000
ST(6) 0000 0000000000000000 ST(7) 0000 847fffdee0000848

Backtrace:
/usr/src/bs/BUILD/glibc-2.1.3/csu/init.c:0(??)[0x80483a8]
/lib/libc.so.6(__libc_start_main+0xff)[0x400369cb]
??:0(_start)[0x8048311]
"csv" 25L, 860C

No comments: