>> Would it really be as fast as writing some printing statements and such, Daved?
It's faster (at least for me).
If you've got a small app and you're already running through VC++, just hit F10 (step over) instead of Run (F5) or Execute (Ctrl-F5). Open and dock the Autos window (Debug > Windows > Autos). If your program has output and you have enough room on your monitor (two monitors helps) then put the console or other window next to the debugger, otherwise it will have to be hidden which isn't ideal for this simple exercise.
Then hit F10 to step over each line of code. When you get to a function you wrote, you can use F11 to step into it, then continue with F10. Watch the variables in the Autos window as they change. That's pretty much what the print statements are doing. The difference is you can see it for every line the first time, instead of adding a few statements and then narrowing down the location.
For one thing, a debugger will INSTANTLY pinpoint a segmentation fault. It doesn't necessarily explain WHY it happens, but it will give you a precise line number. I would hate to have to track down random segfaults by placing prints.
Originally Posted by twomers
I am, but its about number 50 on the list. Theres a trade show in vegas this weekend and we have to make a video of the app in action by then. I fixed most of the major issues, only have 3 features left to put in, and I have a small memory leak to track down. Dont think the debugger will help me with the leak unfortunately...
Originally Posted by brewbuck
Originally Posted by abachler
haha, yeah but tell that to my boss. I had this annoying handle leak for like 4 months because he kept addign features and wouldnt let me take the time to fix it, turns out it only took a couple hours to fix, and its been making teh app crash after 30 minutes for the last 4 months.
>Theres a trade show in vegas this weekend and we have to make a video of the app in action by then.
Heard of photoshop? :)
> and its been making teh app crash after 30 minutes for the last 4 months.
That's easy to fix, introduce a 'feature' where the program restarts every 29 minutes :)
I find the debugger a valuable tool. Can not imagine coding without using it.
I suppose I am just lazy....
I can read, analyse and plug in values to the code to work out what is wrong
I can run the code and the debugger will SHOW me what is wrong.
Originally Posted by twomers
The ability to modify a variable during runtime, jump back and re-run the code, to test small sections of code over a range of values.
The trace statement (same as printf but to the IDE output window). Great for diagnosing real-time/network app issues.
Seeing non fatal exceptions reported as they occur (rather than where they cause a crash).
Edit and continue allows changes on the fly in big/time consuming operations.
Output shows memory not freed on close and gives address to help track it down (or immediate confimation that the leak is fixed / located in the commented out code).
Stack trace to find exceptions.
I debug my programs with OllyDbg lol...