Archive
Seeing array values in the debugger as a list!
VC debuggger has a nice feature to display array values. It works with any contiguous data, for e.g. vector, CArray, native type arrays etc.
Follow these steps…
- IntVector is an array of integers
- Start quick watch by pressing Shift + F9 with IntVector object selected
- Select _First(encircled in red) and press Add watch(encircled in red)
- You should see _First in the watch window
- So now put a comma after _First and add number of elements to view
Here is a screen shot of how I get to see a vector’s array values in the debugger.
See above result in watch window, easy isn’t it? Works in the same way for other array types too!
So have a great time debugging arrays 😉
Conditional breakpoint
How to set a conditional breakpoint
Add this code to your common include or some file where it’s meant to be used…
#ifdef _DEBUG
   #define CBREAK( condition ) if(( condition )){ _asm int 3; }
#else
   #define CBREAK( condition )
#endif
//How to use this macro…
void SomeFunction()
{
   for( int nIndex = 0; nIndex < 100; ++nIndex )
   {
        ...
       CBREAK( nIndex == 32 );
   }
}[/sourcecode]