A memory debugging tool like Valgrind is well suited to this, though it's a fair amount of work to get this up and running. You might just run it through gdb and see where you are when it crashes.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results