Stacktrace logging for linux and gcc. Closes #366.