I have about a year of full time experience with Visual C++ 2008. I am productive but I'm still frustrated with the debugger.

Is this the right forum to get help with the debugger? My biggest problem is not seeing any value when the variable is deeply burried within an array of structs and functions within functions. Yes I know that if isn't in scope there's nothing to report but after 20 years of programming I kind-a know when something is in scope or not.

Walt

I have VS 2008 as well (not quite as much experience, but oh well). One of the first things I noticed about 'watch'es is that sometimes even though a variable's name and information are in-scope, the copy of it that you are looking at may not be. You actually need to set a separate watch for the revised scope.

Sometimes it's hard to see a deeply buried value without drilling down. Have you tried the popup drill down when you hover over the variable's name? Here's a partial screenie of the VS2008 debugger popup for a project I'm working on right now. You can also drill down in a similar fashion in the watch window. Just click the '+' next to the object/array you need more info on.

Thank you Fbody.
I discovered the plus sign but I don't understand what you mean about the "copy of it that you are looking at may not be". How do you "set a separate [to] watch for the revised scope."
Looking forward to your publication of the debugger guide.
Walt

You can have multiple "watch"es set for the same variable. If the watch that you are currently using grays out, it is not currently valid. Simply right-click the in-scope version of the variable in your code and select "add watch" it will create a new copy. You don't necessarily need to create a watch for the top-level object, you can create individual watch's for the object's lower-level structures and properties as well.

For example, in the screen that I posted, the 'farkle' object is a top-level object that is accessible and valid. When execution gets down to line 46 (since that's the first whole command visible) it steps into the farkleGame::applyConfiguration() method. Once it steps into the method, the watch on 'farkle' will no longer be in-scope even though I'm using one of its methods and all of the information is still valid. During this time, you can set a new watch for one of its member variables that is part of the farkleGame class and see the current information in real-time again. Once execution jumps back out of applyConfiguration(), the original farkle object will update and be valid again and the second watch that you created will become invalid.

Wow. Thanks Fbody.
I'll will try it.

Walt

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.