Sign in to follow this  

Debugger break points

This topic is 4860 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 have an application that seems to lock up on rare occasions. I don't know where. It seems to be stuck in an infinite loop. Is there a way without knowing where the problem is to tell the debugger to break wherever the hell the instruction pointer currently is? I'm using VC7.1.

Share this post


Link to post
Share on other sites
The debugger should allow for "breaking" into the debugee. In VC6, there is a "Break" option on the Debug menu for a currently debugged process. Look for a similar menu and option.

Share this post


Link to post
Share on other sites
You could try dumping lots of messages to the "Output" window in the IDE - then when get lock up hit Debug/Break, and the bottom of the output window will show the last messge you outputted.
You can also cause a debugger break point when an illegal condition occurs. Very useful when you're passing pointers around, you can check all pointers at the start of every function, 99.9% you'll never hit these break points, but when that 0.1% happens the program will stop before memory has been too trashed.

These are the macros I use:


#define _DUMP(what) OutputDebugString (what), OutputDebugString ("\n")

#define _DUMP4(what1,what2,what3,what4) do {
char __string [256];
sprintf (__string, what1, what2, what3, what4);
_DUMP (__string);
} while (0)

#define _BREAK(why) do {
_DUMP4 ("%s@%d: %s", __FILE__, __LINE__, why);
_DEBUGGER ();
} while (0)

#define _BREAK_IF(x,why) do { if (x) _BREAK (why); } while (0)





PS: You'll need to add \ to the end of the multiline #defines, the source tags formatter for the webpage screws up if I included them.

Share this post


Link to post
Share on other sites

This topic is 4860 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this