Setting up Visual Studio 2005 to Download Debug Symbols

Setting up Visual Studio 2005 to Download Debug Symbols

  • Comments 8

In Getting Debug Symbols even for Retail Builds I detailed how to set up your machine and Visual Studio .NET to download public symbols from Microsoft's symbol server. This process has changed for Visual Studio 2005 Beta 2.

When debugging your projects it's often helpful or even necessary to see the functions in the call stack. Without symbols, a simple application using EnumWindows might yield the following call stack:

enumwins.exe!EnumWindowsProc(HWND__ * hwnd=0x00490098, long lParam=0)
user32.dll!77d4ccd1()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!77d4cdad()
enumwins.exe!main(int argc=1, char * * argv=0x00850d88)
enumwins.exe!mainCRTStartup()
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

When symbols are loaded along with their respective modules, the call stack is more helpful:

enumwins.exe!EnumWindowsProc(HWND__ * hwnd=0x00490098, long lParam=0)
user32.dll!_InternalEnumWindows@24()
user32.dll!_EnumWindows@8()
enumwins.exe!main(int argc=1, char * * argv=0x00850d88)
enumwins.exe!mainCRTStartup()
kernel32.dll!_BaseProcessStart@4()

In Visual Studio .NET 2002 and 2003 you would configure each Visual C++ project using the project properties dialog with a semi-colon-delimited list of symbol paths. In Visual Studio 2005 you configure this in the global options dialog.

  1. Click the Tools menu.
  2. Click the Options... menu item.
  3. Expand the Debugging node.
  4. Click on the Symbols node.
  5. Use the familiar Add toolbar button to add a location which may include URLs, shares, and symbol server locations.

You can configure multiple symbol paths and manage them - including enabling and disabling paths - from this property page. Check "Load symbols using the updated settings when this dialog is closed" (checked by default) to immediately load symbols for loaded modules when you click the OK button. Note that in windbg.exe, this is equivalent to using .reload /f.

For all of Visual Studio .NET 2002 and 2003, and Visual Studio 2005 you can also tell the debugger to resolve function addresses to DLL exports by clicking on the Native node instead of the Symbols node in step 4 above, and checking "Load DLL exports". This is disabled by default because of overhead when reading the DLL export table. This will only work for exported functions, however, which makes symbols a richer option.

Leave a Comment
  • Please add 6 and 8 and type the answer here:
  • Post
  • Personally, I download the symbol pack for the WinXP service pack I'm running on. These get extracted to %WINDIR%\Symbols. Is there any advantage in using MS's symbol server beyond auto-updating?

    That is, are there symbols on the server not included in the download? I ask because I often debug on machines without network connectivity.
  • Barry, there are a few advantages. While the download packages at http://www.microsoft.com/whdc/devtools/debugging/symbolpkg.mspx do include the RTM symbols and, if applicable, the SP symbols, they do not include the symbols for other updates or for other applications. If you installed a post SP2 QFE for Windows XP, for example, your download package would not have the right symbols.

    There is also the size issue. When you download that package you download all the symbols and may never need most of them. Using the symbol server (especially when caching the symbols locally) you only pull down what you need and they will be the symbols for whatever you have installed.

    Finally, other products should be available on the public Internet symbol server, while the download packages only contain symbols for the Windows version that the download targets.
  • Heath,

    I'm trying to set up visual studio on my home computer so that I can do homework for my c++ class, but I don't know much of anything about this program (or programming in general).

    When I try to debug my c++ program, I recieve a popup saying that I must define the exe to be used for the debug session. Do you know what exe I'm supposed to use? I've tried all the ones in the visual studio folder, plus the windows cmd.exe, but none of those are correct, apparently.
  • Cassie, what edition of Visual Studio do you have, exactly?
  • Visual Studio 2005 Express, C++
  • Apparently, if I choose a different project type, I don't have this issue (I guess I was just not picking the one I needed :-/ )
  • so where is the symbol URL?

  • @matt, it's in the linked article, blogs.msdn.com/.../412658.aspx.

Page 1 of 1 (8 items)