Create a new C file.
#include <stdio.h>
int main()
{
puts((void *)((unsigned long long)-1));
return 0;
}
Compile and run.
[root@slave log]# gcc -o seg seg.c [root@slave log]# ./seg Segmentation fault [root@slave log]# tail /var/log/messages Aug 26 23:39:18 slave kernel: seg[7788]: segfault at fffffffffffffff0 ip 00007fee2413c231 sp 00007ffdb268c488 error 4 in libc-2.12.so[7fee240bb000+18a000] [root@slave log]#
It is very useful if you are working on custom monitoring to track segfault daemons/services/applications on your server.
Leave a Comment