A well known trick was to insert an interruption 3 into the code to trigger a break, see My favorite interruption
__asm int 3;
But as inline assembly is not supported by the x64 visual studio compiler, you may consider using the _debugbreak() function instead.
https://msdn.microsoft.com/fr-fr/library/f408b4et.aspx
#include
....
main() { __debugbreak(); }
But I was facing an interesting issue where that instruction was finally just terminate the program, instead of triggering a message box like the following
I found that there is several registry key which can be use to configure what we want to do in case of crash, break, etc...
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
So if you see that a break isnot trigger or catch by the Just-in-Time Debugger, just add another value called Auto, of type REG_SZ and set its value to 1.
Regards,