I\'m interested in tips and tricks regarding debugging a C/C++ project in Visual Studio\'s debugger. I recently found out that if you have a pointer to a certain data type, let\
Some debugging / watch related tips:
Use the following in the Watch window to find out what GetLastError() would return:
@ERR,hr
If you use Visual Studio 2003 or earlier, use this watch expression to find out the length of your std::vector v:
v._Mylast-v._Myfirst
You can also list the e.g. first 5 entries with this expression:
v._Myfirst,5
This doesn't work when using STLport, and the method obsoleted in VS >= 2005 with the new expression visualizers.
If you want to see the return value of a function, look at the eax register (just enter eax in the watch window). You can even change the returned value. If it's a pointer to a string or array, you can also enter eax in the Memory window to see the underlying string.