4

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.

4
  • 1
    Did you actually change the optimization setting? Then it isn't the debug build. Commented Mar 24, 2011 at 17:28
  • No. I didn't actually change the settings. I just went there to verify that optimizations were turned off. Commented Mar 24, 2011 at 17:28
  • Give more info. Does this happen on a little toy project too or is this specific to the project you are working on now? When did this stop working? What are the compiler and linker command lines? Commented Mar 24, 2011 at 17:36
  • This is for a specific project. I haven't tried reproing it with a top project, but I imagine that it will work. How do I get the compiler and linker command lines? ' Commented Mar 24, 2011 at 18:14

7 Answers 7

4

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

Sign up to request clarification or add additional context in comments.

3 Comments

I upgraded VS2010 to SP1 which should have the hotfix according to that link. But, it still didn't fix it.
I am sorry to hear that. Which Visual studio 2010 edition are you using.
Link-only answers aren't very useful. Please bring the content here.
2

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.

2 Comments

Yeah. That's setup so debug info is enabled. Also, I do see the pdb file being generated.
hmm.. the only thing else I can think of is looking at Caglar Gonul's answer. It appears to be a somewhat well known issue.
1

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....

Comments

1

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.

1 Comment

the bug description and the workaround provided are clear, thx
0

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.

Comments

0

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.

Comments

0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.