SIGSEGV tracing

Suppose your dmesg says this:

[832542.638297] XXX[3140]: segfault at 87 ip 483495 sp 7fffffffb920 error 4 in XXX[400000+26e000]

How to make sense of that? Easy! Check and execute this:

addr2line -e /path/of/XXX 483495

The ip value will tell you where the crash occurred!

Also, when your program is not allowed to write in the current directory execute this as root beforehand to change the location of core files:

echo 1 > /proc/sys/kernel/core_uses_pid
echo /tmp/core > /proc/sys/kernel/core_pattern