Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get stack trace when exception is thrown

I am now debugging a program that utilizes many different threads.

there is an exception that is thrown from time to time. the problem is that there is no way to know what thread caused the problem...

does anyone know an easy way to get the stack trace after the exception is thrown? I thought about simply writing a debug messages but it is going to be a huge :-) i guess there are much better techniques than this one ...

I'm using visual studio 2008 - native c++ project....

like image 462
ofer Avatar asked Mar 01 '23 02:03

ofer


1 Answers

Unless I'm very much mistaken, you need to know which thread triggered the exception in order to use the Visual Studio debugger's call stack view, which is obviously the catch-22 situation you're in at the moment.

One thing I would try is to see if you can get the debugger to break when the exception is thrown (using Debug > Exceptions). You'll have to explicitly enable this, but if you know what type of exception is thrown, this might allow you to work out where it's thrown.

Other than that, putting a breakpoint in the constructor of the exception (if it's one of your own) should also allow you to work out where it's triggered from.

If those methods don't work for you I'd be looking at the debug messages as you already suggested.

like image 136
Timo Geusch Avatar answered Mar 07 '23 08:03

Timo Geusch