Add stack trace output to the debug functions