Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set Visual Studio 2005 to ignore assertions in a specific region of code while debugging

Here's the scenario. I'm debugging my own app (C/C++) which is using some library developed by another team in the company. An assertion fails when my code generates some edge case. Its a pain because the assertion is not formulated correctly so the library function is working OK but I get all these interruptions where I just have to continue (lots as its in a loop) so I can get to the stuff I'm actually interested in. I have to use the debug version of the library when debugging for other reasons. The other team wont fix this till next release (hey, it works on our machine).

Can I tell the debugger to ignore the breakpoints asserted by this section of code (i.e. can it auto-continue for me).

like image 203
Tim Ring Avatar asked Nov 20 '08 12:11

Tim Ring


People also ask

How do I disable assert in Visual Studio?

In Visual Studio, go to Debug / Windows / Exception Settings. In the Exception Settings, go to Win32 Exceptions / 0xc0000420 Assertion Failed. Uncheck the box in front of that entry.

How do I skip the code while debugging in Visual Studio?

You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.

How do I enable exceptions in Visual Studio?

With a solution open in Visual Studio, use Debug > Windows > Exception Settings to open the Exception Settings window. Provide handlers that respond to the most important exceptions.


1 Answers

If the code is triggering breakpoints on its own (by __debugbreak or int 3), you cannot use conditional breakpoints, as the breakpoints are not know to Visual Studio at all. However, you may be able to disable any such breakpoints you are not interested in by modifying the code from the debugger. Probably not what you want, because you need to repeat this in each debugging session, however still may be better than nothing. For more information read How to disable a programmatical breakpoint / assert?.

like image 84
Suma Avatar answered Sep 30 '22 03:09

Suma