I've been programming for about 3-4 years and using MSVC 2005 at the moment.
However, I havent used the MSVC debugger until now because I didnt know how to use it..
Are there any tutorials, any helpful/beginner tips?
I would really like to learn how to use it.
I used std::cout to print the data (to fix the bugs) and see the point that program reaches.
Thanks a lot for help
If I remember correctly, I learned the debugger from a single chapter in my first book plus playing with it a lot. For an introduction, Google produces some info.
The two links may be for VC++6, but the basic functionality is the same as in later versions, only the UI may have changed a little.
> I used std::cout to print the data (to fix the bugs) and see the point that program reaches.
When you next use this technique to find a bug, and subsequently fix it, add the bug back into the code and try and find it again using the debugger (knowing more about what you're looking for).
Most of the time, it's just
- breakpoints to halt the program
- step, step into, step over to control the execution
- watch variables, to replace your debugging 'cout' statements.
How to recover memory leaks?
1. You enable this feature in your code.
2. You run the program, and at the end you'll get a list of leaked blocks. Along with each block is an allocation number.
3. The next time you run the program, you can use the allocation number to 'break' when that block is allocated once more. You then trace carefully to see who ultimately owns that block, and from that perhaps understand why they failed to free it.
As with all things, practice on a small program which say calls malloc twice and free once.
Thanks for help..
Sorry, but how can I enable this feature in MSVC 2005?
I found this website: http://msdn2.microsoft.com/en-us/lib...h3(VS.80).aspx
Seems like it works!