Sign in to follow this  

MSVC2010 Possible Bug?

This topic is 2057 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My program is coded in C++. It's a pretty general question so I should not need code to give an example. Basically I have member values that come up as invalid in the bottom box during debug mode. I checked these values by calling some functions that would return them and the exact same values the debug mode says is invalid comes back with valid values. I made sure I did the value checks at the exact same point in the program that the debugger shows them as invalid. In case it helps and is part of the cause these values are created after manipulating values read from a file in binary format with ifstream. I'll reiterate, these values are for sure valid because their return values are valid, but the debugger is saying they aren't. Is it a bug or is it possible I am still doing something wrong?

Share this post


Link to post
Share on other sites
I know from experience that the MSVC debugger can very easily get confused when debugging optimized code. It doesn't understand what's going on when variables get optimized into registers for example.

Normally in debug mode with optimizations off it does tell you the correct answer, but it's possible there's a bug. The best way to verify that the program is working correctly is to either examine the disassembly, or add some extra debug output.

It's hard to be more specific without being able to reproduce it. A small example program that demonstrates the problem would be handy.

Share this post


Link to post
Share on other sites
It appears this bug just appeared today after having added a new member to the class showing the invalid values in the debugger. A simple int and two functions setting the int and returning the int. For some reason adding this caused the debugger to go nuts showing other members in the class as having outrageous values even though they do not. The values that are shown as invalid are however read from a file during run time and the new member I added is not, but only because it is needed after the load of this class. It shouldn't have any effect on the other members since I didn't add it to my save and load functions. I guess I am just going to move on though and let this go.

Update: I went ahead and added the member to the save and load functions and saved a new instance of the class for loading/testing. The problem is still there but it is worth noting the new member does not at all appear in the debugger under the list of class members. This all seemed to familiar and it was because I had remembered this happening before and that the problem had eventually disappeared on its own. I am not going to worry about it any longer.

Share this post


Link to post
Share on other sites
I don't know if it goes without saying, but did you try a clean/rebuild of your project? It may affect what you see, versus what the debugger thinks is true, if you edit a header and it does not recompile correctly. If it is working, then great, but if you didn't do a rebuild, that may have fixed it. Not saying you forgot, but there was no mention, and can't hurt to cover the bases in case it happens again :)

Share this post


Link to post
Share on other sites
[quote name='KymikoLoco' timestamp='1335550882' post='4935446']
I don't know if it goes without saying, but did you try a clean/rebuild of your project? It may affect what you see, versus what the debugger thinks is true, if you edit a header and it does not recompile correctly. If it is working, then great, but if you didn't do a rebuild, that may have fixed it. Not saying you forgot, but there was no mention, and can't hurt to cover the bases in case it happens again [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
[/quote]

You were right to ask. No I didn't rebuild, building always seemed sufficient. However rebuilding did make the problem go away. Thank you. + rep for you [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]

Share this post


Link to post
Share on other sites
One important rule:

If you make last minute changes while compiling, save the file and are told "I'm kind of busy compiling, save anyway?" you should be aware of the consequences of saying "Yes". Essentially it means that the next time you compile, it will likely NOT rebuild the file, because based on the time stamp it thinks it already did compile the latest version.

Share this post


Link to post
Share on other sites

This topic is 2057 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this