Jump to content
  • Advertisement
Sign in to follow this  
impulsionaudio

custom assert that debugger breaks on

This topic is 3437 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would like to write my own assert that, instead of exiting the program, causes the debugger to break on the assertion failure. I would like a solution that does not require wrapping everything in try/catch blocks. Does anyone know how to write such a thing? Thanks

Share this post


Link to post
Share on other sites
Advertisement
In Windows, triggering an interrupt 3 will break into the debugger. You can do this within inline assembly or your compiler may have functions to do it. Ex: in MSVC, you can use __debugbreak().

Share this post


Link to post
Share on other sites
If you use __debugbreak() or int 3, the program will still end if you're not using a debugger. What you can do if open up a dialog box or message box with options, such as "Ok" and "Cancel" where one triggers a breakpoint and the other just attempts to continue the application.

Share this post


Link to post
Share on other sites
In Visual Studio 2008EE, running the debugger will catch the standard library assert() function. There is no need to use something else.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!