I do not know if you used any IDE, but in eclipse you can switch to the debug mode, and change between the different threads. In each thread you can see the stack trace.

How to Debug time critical code without stopping it

Software is oftenly time dependent. For instance if it interacts with another component on a remote server, the interaction might be time critical, which means that it shall not be stopped or interrupted as it otherwise might change the behavior of its system. The problem is, that even such software is prone to errors, but in case its runtime is stopped in order to debug the error it might change its behavior which might make it difficult to find out the problem behind the error.
Subscribe to Debugging