How to use the Microsoft Debug Symbols Server with MsDev
Last Updated: October 3, 2003
Microsoft's symbol server makes it much simpler to find the symbols for
Microsoft system DLLs. Downloading the correct symbols for your machine
is simple, but getting Microsoft Visual C++ 6.0 to load the symbols is
not as obvious. The description of how to do this seems to be scattered
across the web so I decided to write a guide describing how to
get it to work from scratch.
The following steps are all sufficient for getting the symbols downloaded
and installed but they might not be all necessary.
Many thanks to Lee Feigenbaum and Elias Torres who taught me how to do this.
- Download and install Debugging Tools for Windows:
Go to http://www.microsoft.com/whdc/ddk/debugging/symbols.mspx.
This page describes how to set up "Debugging Tools for Windows" for downloading
the symbols from the Microsoft Symbols Server.
-
Run WinDbg and set the "Symbol Search Path" to
SRV*C:\symbols*http://msdl.microsoft.com/download/symbols
You can replace "C:\symbols" with whatever location you choose. The symbols will be downloaded to that directory. Make sure
the directory exists. You can set the "Symbols Search Path" in WinDbg via the menu at "File->Symbol File Path...".
-
Run an executable from within WinDbg and break into it one it is initialized.
You can run an executable in WinDbg
via "File->Open Executable...". I typically open something like "iexplore.exe" which happens to load many of the modules for
which I care to have symbols (comctl32.dll, ole32.dll, OLEAUT32.dll, etc.). You might have to "Debug->Go" a few times as the
executable initializes. You will see the modules that are being loaded in the WinDbg window. Once it is initialized, do a
"Debug->Break" into the app.
-
Run ".reload /f" in the command window of WinDbg to download the symbols for all currently loaded modules.
The command window will only allow commands to be entered while the executable is stopped. You enter commands at
the bottom of the window where there is a prompt that looks something like "0:004>". As the symbols are downloaded, all
you will see are dots being written to the Command window to show progress.
-
Copy the .pdb files downloaded to "C:\WINDOWS\symbols\dll" or "C:\WINNT\symbols\dll" (whichever is appropriate).
If the directory does not yet exist, create it. Only copy the .pdb files. The files must all be in that directory, not
within any subdirectories.
-
Add the following registry values:
Key: HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Build System\Components\Platforms\Win32 (x86)\Directories
-
Value:
Pdb Dirs
Type: String
Data: "C:\WINDOWS\symbols\dll" or "C:\WINNT\symbols\dll" as appropriate
-
Value:
Symbol Dirs
Type: String
Data: "C:\WINDOWS\symbols" or "C:\WINNT\symbols" as appropriate
-
Value:
Symbol Dir
Type: String
Data: "C:\WINDOWS\symbols" or "C:\WINNT\symbols" as appropriate
-
In Visual C++, ensure that "Load COFF & Export symbols" the "Tools->Options..." "Debug" tab is checked.
-
Debug an executable in Visual C++ to ensure that it worked.
In the debug trace window, you will see the modules load with symbols. For example:
Loaded symbols for 'C:\WINDOWS\system32\user32.dll'
Loaded symbols for 'C:\WINDOWS\system32\ole32.dll'
NOTE:
It is a good idea to periodically update the .pdb files by downloading them again using WinDbg and copying them to the appropriate directory.
This will ensure you have the correct version in case any service packs or hotfixes have modified these files on you machine.
Disclaimers:
This information is provided "as is". Use it at your own risk. I cannot be held responsible for any problems caused by
following these instructions. Any trademarks mentioned are the property of their respective owners.
Copyright © 2003 Jordi Albornoz. Feel free to copy
or use this information in any way.