Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 710
Roman Kolesnikov Avatar asked Apr 22 '16 06:04

Roman Kolesnikov


People also ask

How do I pause Debug code in Visual Studio?

You can press the Pause button in the debug toolbar (or hit ^⌘Y/Alt+Ctrl+Break or choose "Debug|Pause from the menu).

What is F11 in Visual Studio?

F11 -> Execute code one statement at a time, following execution into function calls (Step Into).

How do I add a conditional breakpoint in Visual Studio?

Right-click the breakpoint symbol and select Conditions (or press Alt + F9, C). Or hover over the breakpoint symbol, select the Settings icon, and then select Conditions in the Breakpoint Settings window.


1 Answers

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

breakpoint visual studio

like image 130
hansmaad Avatar answered Oct 27 '22 01:10

hansmaad