Setting up a Symbol Server in Team Build

Thursday, September 22, 2011
by asalvo

With the advances coming in the Visual Studio 2011 tooling around Intellitrace, we decided it was time to start publishing symbols as part of our automated build process. A symbol server is nothing more then a windows share that contains a folder called 000Admin and folders for your symbols. The folders are all created for you once you get the publishing enabled.

Enabling Symbols

If you have Team Build already setup and build defined, publishing symbols is nothing more than a quick change to the build definition. In the build definition under process, edit the Source and Symbol Server Settings. You will need to change Index Sources to True and set the Path to Publish symbols to a network share that your developers/debuggers have access to.

image

One thing you will want to check is if your assemblies have been configured to output pdb files. In the debug configuration, the default is full debugging information, which includes pdb. However, for non-debug configurations, someone may have thought it was a good idea to not create pdb files. You can check this by opening the project properties, clicking on build, selecting the configuration and then clicking Advanced down at the bottom of the page.

image

Symbol Folder Layout

So what does the symbol folder look like? Well it contains a folder named 000Admin, which you can think of as a file based database which tracks the symbols and actions around the symbol server. There is also one folder for each assembly that you publish to the symbol server.

Root Symbols Folder
image

000Admin

The 000Admin contains all of the artifacts that are used to keep image track of the symbols published on the symbol server. It contains a history.txt, lastid.txt and server.txt, and a series of numbered files ########## starting with 0000000001. LastId just tracks the last id that was used, and corresponds to the numbered files, which in turn corresponds to a specific build. History.txt tracks adds and deletions to the symbol server, and finally server.txt contains a mapping of the current symbols.

When you delete a build, the numbered file for that build gets appended with “.delete”, and the symbols themselves are removed from the build server.

history.txt
image

lastid.txt
image

server.txt image

##########
image

*.pdb Folders

Each assembly that is published gets it’s own folder. Within each folder is a series of uniquely named sub folders. The subfolder name matches with what is in one of the ########### files in 000Admin, and each of those subfolders corresponds to a version of the assembly which is tied to a specific build. In our example below, View.pdb is the second folder shown in the first screen shot above which shows the root folder of the symbol server.

Viewer.pdb
image

 

Inside the subfolder is the actual pdb file, and a refs.ptr file. The ptr file containssome of the same information as the server.txt and history.txt and is used to identify which build the pdb file is associated to.

Subfolder Contents
image

 

Using the Symbols

In Visual Studio, go to ToolsOptions, and then under DebuggingSymbols add the path to your symbol server.

image

If you want to be able to step into your source code, then you need to enable one additional option under DebuggingGeneral, and that is “Enable source server support”.

image

So how exactly does that work and where are we getting the source from? During the build process, before publishing the symbols, Team Build will index the sources. One of the things this does is update the PDB file to contain the path to the TFS server, the full path to the source file (include branch), and the version. With this information, Visual Studio can query the pdb file during debugging, and request the source code file from TFS, allowing you to step into the code.

In a future post I’ll go into how to use the new intellitrace features to debug production applications. But for now, you can watch the video from //Build 2011 on Channel 9.

Comments

comments powered by Disqus