Debugger break points

Started by
1 comment, last by Beelzebub 19 years, 8 months ago
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.
Advertisement
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.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
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.

This topic is closed to new replies.

Advertisement