PDA

View Full Version : MSVS 2003, 2005 debugger issues



VirtualAce
01-14-2009, 10:58 PM
Why is that the MSVS debugger cannot look at the contents of dynamic arrays and cannot look into template classes in the watch window?

For instance using Boost or any STL container pretty much assures you that the debugger cannot look at the contents of the object.

It also appears that it cannot look at the contents of any dynamic memory.

Is there some setting I'm missing or is this standard behavior?

abachler
01-14-2009, 11:17 PM
That is normal. since it cannot know at runtime how many elements the dynamic array holds.

ok, its a double*, but does it point to a value, or an array of values. its a double**, does it point to an array of pointer to values, or an array of array of values, or some comblination of the two? (yes ive seen this in actual code). Then when you get into the whole stl stuff, the data is not guaranteed to be in contiguous memory.

CornedBee
01-15-2009, 02:21 AM
Actually, my VS 2005 pretty-prints all STL containers like it's supposed to. Works perfectly.

VirtualAce
01-15-2009, 02:39 AM
I'll re-check my 2005 to see if I'm incorrect here. I know 2003 professional does not pretty print STL containers.

Elysia
01-15-2009, 04:18 AM
That might be because "pretty-print" wasn't implemented until 2005.

Daved
01-15-2009, 11:56 AM
You have the ability to alter what gets shown in the debug window for different classes. It's somewhat complicated and might not be as easy in 2003 as you'd like, but it's worth a shot.

brewbuck
01-15-2009, 12:08 PM
Why is that the MSVS debugger cannot look at the contents of dynamic arrays and cannot look into template classes in the watch window?

Sure it can...

In quickwatch, type "ptr,n" where ptr is the pointer, n is the number of elements you want to see

Elysia
01-15-2009, 12:37 PM
You have the ability to alter what gets shown in the debug window for different classes. It's somewhat complicated and might not be as easy in 2003 as you'd like, but it's worth a shot.

I never got such manipulation to work properly...
My main complaint is that the VS debugger pretty prints a lot of types, but sometimes I just want to see plainly how they look, as I want it! But Microsoft has chosen often not to include an option to do that.

Codeplug
01-15-2009, 12:54 PM
Google "autoexp.dat". It's been around since 6.0. Rename it and everything should show "as-is".

gg

Elysia
01-15-2009, 01:07 PM
Pretty print is good, but just sometimes unwanted.

VirtualAce
01-15-2009, 01:54 PM
Google "autoexp.dat". It's been around since 6.0. Rename it and everything should show "as-is".


Is this something that would be wise to put on a dev box at work? I'm a little hesistant at messing with my IDE at work and less so with my one at home.

CornedBee
01-15-2009, 02:17 PM
My main complaint is that the VS debugger pretty prints a lot of types, but sometimes I just want to see plainly how they look, as I want it! But Microsoft has chosen often not to include an option to do that.

Yes, they did.
http://msdn.microsoft.com/en-us/library/75w45ekt(VS.80).aspx

Elysia
01-15-2009, 02:20 PM
That's just an option on how to display a member. But if you want to scourge through the internals in a vector?

Daved
01-15-2009, 02:36 PM
>> Is this something that would be wise to put on a dev box at work? I'm a little hesistant at messing with my IDE at work and less so with my one at home.

I did with my work IDE (thanks Codeplug for remembering the name). It didn't cause me any problems.

I would actually recommend using it for your dev box at work, although I'd try it at home to get a feel for it first since it is not terribly straightforward and you don't want to waste too much time in the office trying to get it to work right.

CornedBee
01-15-2009, 02:41 PM
That's just an option on how to display a member. But if you want to scourge through the internals in a vector?

What do you mean? If you have a vector v, then "v !" will give you the standard object view of the vector, which means that you can look at its members.
If you want to get more low-level than this, take the address of the vector and paste it into the memory viewer.

VirtualAce
01-15-2009, 03:08 PM
What about the contents of a map or list? This would be quite handy.



...although I'd try it at home to get a feel for it first since it is not terribly straightforward and you don't want to waste too much time in the office trying to get it to work right.


Ideally plugging it in and having it work as is would be nice. I'm quite convinced by now that's not possible with anything in computers but it would be nice.

Daved
01-15-2009, 03:28 PM
>> take the address of the vector and paste it into the memory viewer
Or manually update the autoexp.dat to have it show what you want. I did this with an old string implementation and it helped a lot.

>> Ideally plugging it in and having it work as is would be nice.
I would hope that there would be people who have done this that could make their changes available for others, but I haven't tried it in years so I wouldn't know. Whatever changes you test at home could probably be carried over to your work machine immediately (assuming they're the same version).

BTW, to my recollection my best success with this was in VC 6.0. I believe I tried it with 2003 but don't remember much about it.

P.S. http://msdn.microsoft.com/en-us/library/aa730838(VS.80).aspx

Elysia
01-16-2009, 02:58 AM
What do you mean? If you have a vector v, then "v !" will give you the standard object view of the vector, which means that you can look at its members.
If you want to get more low-level than this, take the address of the vector and paste it into the memory viewer.

I see. Didn't see that one.

VirtualAce
01-16-2009, 07:25 PM
I tried this in VS2005 and it works great. Had some trouble with a map but dynamic arrays, STL lists, vectors, queues, dequeues, and stacks work like a charm. I guess it wouldn't hurt to read the help files for the compiler once in awhile. Thanks for the information because it's a lifesaver.

Tried this in 2003 and it did not work. So guess I'm out of luck at work unless I use the file recommended in this thread.

VirtualAce
01-19-2009, 07:41 PM
Found this on gamedev. To look into an STL container in VS2003 just append .Myfirst,<x> in the watch window where x is the number of items to display from the container.

So for a vector named myVector it would look like this in the watch window:

myVector._Myfirst,10

This would display the first 10 objects in the vector myVector.