Force C++ program to pause in Visual Studio debugger

I'm debugging C++ program compiled with MSVC under Windows. I want to investigate issue linked with multi threading. So I put ASSERT in my code and when program reaches ASSERT it displays window about ASSERT (Standart [Abort], [Retry], [Ignore] window) with proposal to pause program in debugger. I press [Retry] button and program pauses. BUT while I was pressing the button other threads continue to execute. So the question is how to immediately stop the program when it reaches some point to see what other threads was doing at that time?


You might want to set a conditional breakpoint instead of using an assert :


In case you want to do it programmatically, use DebugBreak. (C# has an equivalent api System.Diagnostics.Debugger.Break)

In case you want to do it from ide, from the msdn page you can put a breakpoint (or break all the application, ctrl+alt+B) from visual studio and then control the thread execution using "freeze" and "thaw" in the thread window.

链接地址: http://www.djcxy.com/p/91536.html

上一篇: 状态似乎被覆盖而不是合并

下一篇: 强制C ++程序在Visual Studio调试器中暂停