开发者

Visual Studio 2010 doesn't display debug info for local variables

Visual Studio 2010 doesn't display debug info for local variables. I have no problem seeing my class 开发者_开发百科variables though. Is there some setting that I'm missing?

This is a "debug" build.

I tried going to Project Properties -> C++ -> Optimizations and disable all optimizations.


This can help. http://support.microsoft.com/kb/2452649

This is the main entry http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/6133b9d0-81c6-4e30-bfe5-5b3d6e104300


check to make sure you're project is setup to export debug symbols. These should be .pdb files. They contain debug information for your code. I believe the setting is under project->Linker->generate debug info.


For those who have any problem regarding this issue...

  1. download the patch from here http://archive.msdn.microsoft.com/KB2452649/Release/ProjectReleases.aspx?ReleaseId=5350
  2. Restart computer
  3. rebuild your project

and most probably everything will be good then....


If you are experiencing it with within a switch-case statement just add a conditioned empty command like

if(true)
;

for testing purposes. It seems that some older versions of Visual Studio suffered from a bug where a missing conditioning of any kind (while, if...) in one case rendered Locals during debugging in following cases invisible.


If you're using Visual Studio 2010 Express (like I was) this is fixed by getting Service Pack 1, which you can get by running Windows Update.


Always include just the compatible debug libraries:

I came here because Visual Studio 2010 didn't display debug info for some local variables within the opencv 2.4.2 library. In Mat _InputArray::getMat(int i) const I got to see several variables but k and vv were missing. (and I got an exception in cv::_interlockedExchangeAdd when getMat would (wrongly) return only empty matrices.) Anyway, the problem was: I had included (as library, in the PATH for the dlls and as #pragma comment) both the debug and the release libraries. This seemed to have caused the problem. Everything worked well after included just the debug libraries.


I was able to fix this problem in VS2015 by enabling Options > Debugging > General > Use Native Compatibility Mode.

MSDN says that "when this option is selected, the debugger uses the Visual Studio 2010 native debugger instead of the new native debugger." We build with Intel C++ 12.1, which is based on VC10, so that makes sense!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜