printing stack trace of underlying thread error

I want to see where the exception was thrown in the underlying thread when the program terminates.