Friday, April 30, 2010

linux: extremely useful BASH scriptfoo for investigating coretraces:

grep -E "(#0 |#1 )" [[FILENAME]]  | grep -vE "(kernel_vsyscall|pthread_cond_timedwait|nanosleep)"
[/name_of_coretrace_file][/filename]

Example:
[root@domain ~]# grep -E "(#0 |#1 )" coretrace_4.2_upgrade_crash | grep -vE "(kernel_vsyscall|pthread_cond_timedwait|nanosleep)"<br />#0  0x0040abc8 in _IO_vfscanf_internal () from /lib/libc.so.6<br />#1  0x0041a451 in vsscanf () from /lib/libc.so.6<br />#1  0x003afdeb in read () from /lib/libpthread.so.0<br />#1  0x003afdeb in read () from /lib/libpthread.so.0<br />#1  0x003afa0e in __lll_mutex_lock_wait () from /lib/libpthread.so.0<br />#0  0x00130244 in _fini () from /lib/libSegFault.so<br />#1  0x0011e5b2 in _dl_fini () from /lib/ld-linux.so.2<br />#1  0x003afdeb in read () from /lib/libpthread.so.0<br />#1  0x003afdeb in read () from /lib/libpthread.so.0<br />#1  0x003afdeb in read () from /lib/libpthread.so.0<br />#0  0x0040f948 in _IO_vfscanf_internal () from /lib/libc.so.6<br />#1  0x0041a451 in vsscanf () from /lib/libc.so.6<br />#1  0x003ea3d6 in kill () from /lib/libc.so.6<br />#1  0x003af365 in sem_timedwait () from /lib/libpthread.so.0<br />


Now you know which are the interesting threads - the ones that are not doing kernel_vsyscall() or pthread_cond_timedwait() or nanosleep() are printed as the output of this command-chain.

No comments: