Martin Martin - 3 months ago 27
C++ Question

How to reset the VisualStudio (VS2010, VS2012) debugger cache?

I'm trying to debug a large project using Qt, but I have problems debugging.
It's the same as in this question, but the answers there didn't help and I'm using VS2010 so I can't install the fix mentioned there.

I reproduced the problem with VS2008 (as well as the solution, see below).

I just learned: The "mouseover" feature is called DataTips.

The problems:


  • The mouseover and "local" window contents of member variables are wrong (compare with question linked above).

  • The mouseover and "local" window contents are showing old member names. I renamed a variable from 'size' to 'sizeMm' and the debugger still shows 'size'.



Obviously the debugger is using some old information which has to be stored somewhere.

Here is what I tried:


  • restarted Visual Studio

  • cleaned and rebuilt my project folder

  • tried different project settings (e.g. turning optimizations on and off again)

  • manually deleted the .obj files

  • manually deleted the .sdf file

  • reordered the members in the class

  • removed most Qt code from the class

    EDIT :

  • as Neil Kirk suggested in an answer, I tried the compiler options /Z7, /Zi and /ZI.

    /Z7 is supposed to write the debug information into the object files.

  • deleted all content in all ./Debug directories



The debugger must take its information from another source. But from where?

What do I have to do to make the debugger clear its cache, re-scan my class and update its internal information?




Current investigation status:

I found about 6 places where the information could have been, e.g. the
ipch
folder / files. But still no success.

I ran a fulltext search against each hard drive. It found some pdb files in other projects that I deleted.

Now I fixed the bug, but I didn't find it.




The problem persists with VS2012. The pdb files are now named
vc110.pdb
, though.

Answer

A fulltext search found some .pdb files (mostly vc100.pdb), partially in directories of other projects linking to the same lib, which contained old symbol names.

I deleted all found .pdb (and .idb) files, recompiled and now it shows correct behavior again.

Whoever experiences the same problem should try this solution.

//Yet I have no answers as to
//- where exactly the debugger searches for its information and
//- in which way the pdb files are (re)created and interconnected and
//- how the problem came to be in the first place.

Edit

I was able to recreate the problem. And I think I know what happened:

I'm including several libs that are based on a common base lib. Changes in the base lib only get reflected in the other included libs if I rebuild them. If I don't rebuild these libs after some minor change in the base lib (in my case: adding a member to a class), the appropriate vc100.pdb file remains unchanged. Because an include path is set to that library's directory, its vc100.pdb file seems to be used by the VS debugger.

The solution is to delete these vc100.pdb files or to rebuild all libraries.


VS2012

The file names change from version to version. VS2012 uses vc110.pdb and so on. I now delete all *.pdb files in the code directory + subdirectories.