How to load symbols in Visual Studio 2012

When I am debugging my app I see messages:

cannot find or open the PDB file

I seem to remember being able to specify the location of the PDB file while debugging the app. How can I do this? I'm using Visual Studio 2012.


Adding Symbols Location

Open Settings: Tools->Options -> Debugging -> Symbols and add directory, where your .PDB files are located.

screenshot of Visual Studio Interface where this menu located

You can add custom path, like for each project, and also you can edit common path, where Visual Studio will save all .pdb cache.

Making post-build script

I made in each project post-compile event, which copy all .pdb to one folder, by this i have all in one place. But you can store it separately, which i found not so convenient, as it require each time edit list of locations.

Example of post-debug script to copy .pdb and .dll to Symbols cache location:

xcopy /Y /R "$(TargetDir)$(ProjectName).pdb" "D:VS_CACHE"
xcopy /Y /R "$(TargetDir)$(ProjectName).dll" "D:VS_CACHE"

Solving problem if symbols not found

When you in debug mode, and for some reason symbols not found, it can be because of multiple reasons:

  • You have .pdb in Symbols cache, but it's outdated (you can get if this a case, if you put breakpoint in code and hover it)
  • You have multiple .dll which use this part of code (you can get if this a case, if you put breakpoint in code and hover it)
  • Symbols not loaded, in this case you can check it by going to: Debug-> Windows -> Modules and trying to load needed module.
  • screenshot of Visual Studio interface Modules -> Load Symbols

    Making Debugging more easy:

    To re-attach VS Debugger to running application, i recommend to use this free Visual Studio add-on (support VS 2015):

    ReAttach : visualstudiogallery.msdn.microsoft.com/8cccc206-b9de-42ef-8f5a-160ad0f017ae

    It will save you a lot of time! :)

    链接地址: http://www.djcxy.com/p/74564.html

    上一篇: Visual Studio忽略输出文件夹中的PDB文件

    下一篇: 如何在Visual Studio 2012中加载符号