Finally some tips. The normal destination of printf (stdout) is buffered differently when redirected to a file; so you might not see any debug messages you added. Always send debug messages to stderr.
Programs which randomly crash might be due to a faulty piece of hardware - so don't waste effort debugging on bad hardware.
Not all the tools are as stable on all architectures.