Does Visual Studio have "break where you are" functionality?

Lately we have started to deal with infinite loops in our engine and I have no idea how to deal with them effectively. The app just hangs for an eternity and I can't stop running to figure out what's going on. Placing a normal breakpoint in prime locations (refresh loop) does nothing. I'm pretty sure the problem is the constantly running somwhere loop, but due to the size of the code, I can't even start wondering where to look for it.

So my question is, how do you break the execution of the application in Visual Studio in some arbitrary place in the code where the application is at that time? Something like "stay where you are". Is this possible theoretically?

+3


source to share


1 answer


Use Debug + Break All of course.

This, of course, does not necessarily break your program with a good address that matches one of the statements in your program. It is quite likely that if setting breakpoints did not cause a break. You will probably see a notification from the debugger that it cannot display the source code. Or, for that matter, it might not have picked the right stream.



So the first thing you want to do is use Debug + Windows + Threads and make sure the correct thread is selected. Double click the one you want to debug. The next thing you want to do is look at the Debug + WIndows + Call Stack window. It should at least depict some of your methods, giving you a hint of how it turned out in never-landing ground.

And it is unlikely that it is deadlocked by its own code or operating system call. To verify this, you need to enable unmanaged debugging. Project + Properties, Debugging, check Enable native code debugging. And make sure you have symbol server enabled, so you get debug information for the operating system DLL. Tools + Options, Debugging, Symbols.

+5


source







All Articles