Domanda

My VS2008 debugger show corrupted values for almost for all the variables. I know it is not correct since I just printed those values which gives me correct values.

Here are some of those bogus values, enter image description here enter image description here

but meantime in the consol prints,

enter image description here

So, I don't get what is wrong here. But I think the issue should be with the Visual Studio. Anyone knows how to fix this ?

Updated: This is a Qt application.And Here are the things I have tried:

  • Rebuilt all the projects
  • Deleted debug folder and rebuilt
  • Got a fresh copy from git repo and rebuilt
  • Installed SP1 and all the C++ related updates/hotfixes for VS2008
È stato utile?

Soluzione

If the issue doesn't appear in non-Qt apps, then some setting in this particular application could be compiling with optimizations turned on.

It gets confusing in Visual Studio, but nothing stops a "Debug" build to have optimizations turned on, and a "Release" build to have optimizations turned off (more often, you will see Release builds with optimizations turned off).

On top of that, it is possible to have a "Debug" build that cannot be debugged due to the debug symbols not being produced (two more settings in the Project turns on/off symbols during compilation and linking). In other words, any combination of "debugging on/off" and "optimizations on/off" is possible in "Release" and "Debug" build configurations.

Since you are producing symbols, the issue won't be that the symbols aren't being produced. Therefore, please check all of the projects you're building, and look at the "Optimizations" setting, and not whether the configuration is named "Debug" or "Release".

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top