Windows Debugging Symbols - Not Loading

Ajay picture Ajay · Aug 21, 2011 · Viewed 48.9k times · Source

I am having Windows 7 x64 SP1. I have downloaded symbols from:

http://msdn.microsoft.com/en-us/windows/hardware/gg463028

I have downloaded and installed x64 RTM and x64 SP1 symbols for Windows 7 x64 SP1. Installed on T:\Symbols folder.

But When I debug a 64-bit native C++ application, the symbols would not load at all. For ntdll.dll, for instance, the PDBs are located in:

  • T:\Symbols\ntdll.pdb\6192BFDB9F04442995FFCB0BE95172E12
  • T:\Symbols\ntdll.pdb\CFF40300FD804691B73E12CF2A150EE02

But Visual Studio (2008/2010) will not load symbols. While debugging, from Modules View, I select ntdll.dll and say Load Symbols From -> Symbol Path, the specify the ntdll.pdb. For both of mentioned paths, it will always say:

A matching symbol file was not found in this folder.

I have also added this folder (T:\Symbols) in Debugging -> Options, but it will still not load the symbols. While debugging, Load All Symbols button would be enabled, and clicking would not load the symbol either!

For 32-bit the PDB filename would be wntdll.pdb for ntdll.dll and would be stored in GUID-named folders in fashion mentioned above. But VS will not load symbols for 32-bit debugging either.

Quite interestingly (and frustratingly), when I select Load Symbols From -> Microsoft Symbols Server, it will download and load the symbols perfectly. It will download the symbols at following location (full path for ntdll):

enter image description here

\Users\...\AppData\Local\Temp\SymbolCache\ntdll.pdb\6192BFDB9F04442995FFCB0BE95172E12

Here you can see the GUID is matching with the GUID-named folder in T:\Symbols path, but for manually installed symbols VS is rigid not to load it!

For NTDLL.PDB, despite the respective folder being same, and the size of PDB also being same, the timestamp might be different.

Sometimes VS would also place symbols in:

C:\...\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols

If VS would download correct symbols ONLY from Microsoft Symbols Server, then what the use of locally downloaded symbols?

My question is basically how to load locally downloaded and installed symbols?

Answer

Alois Kraus picture Alois Kraus · Aug 21, 2011

The download links for the RTM or SP1 symbols are pretty much useless. After each patch day you will get a changed ntdll.dll or other central OS libraries. This will render your "old" pdbs useless. You need to download them therefore from the symbol servers to be sure that you are up to date.

But since not all dlls are changed you should set your Symbol server download cache to the same location where you have unpackaged your downloaded symbols.

Go to:

Tools - Options - Debugging - Symbols

and set the path for Cache symbols in this directory.

Load all symbols means that you do load all symbols for all modules that are loaded in your current process. But it will not dowload all symbols for all dlls that are used by Windows. If you do download Windbg you get a tool called symchk.exe which allows you to download the symbols for all binaries recursively.