A source server enables the debugger to automatically retrieve the source files that match the current target. To use a source server, you must be debugging binaries that have been source indexed at build time and whose source file locations are embedded in the PDB files.
Debugging Tools for Windows includes the source server SrcSrv (Srcsrv.exe).
Using SrcSrv with a Debugger
SrcSrv can be used with WinDbg, KD, NTSD, or CDB.
To use SrcSrv with the debugger, enter the following command to set the source path to srv*.
You can get the same result by entering the following command.
Setting the source path to srv* tells the debugger that it should retrieve source files from locations specified in the target modules' symbol files.
If you want to use SrcSrv and also include a list of directories in your source path, use semicolons to separate
srv* from any directories that are in the path.
If the source path is set as shown in the preceding example, the debugger first uses SrcSrv to retrieve source files from locations specified in the target modules' symbol files. If SrcSrv is unable to retrieve a source file, the debugger attempts to retrieve it from c:\someSourceCode. Regardless of whether srv* is the first element in the path or appears later, the debugger always uses SymSrv before it searches any other directories listed in the path.
You can also use .srcfix+ to append
srv* to your existing source path, as shown in the following example.
3: kd> .srcpath c:\mySource Source search path is: c:\mySource 3: kd> .srcfix+ Source search path is: c:\mySource;SRV*
If a source file is retrieved by the source server, it will remain on your hard drive after the debugging session is over. Source files are stored locally in the src subdirectory of the home directory (unlike the symbol server, the source server does not specify a local cache in the
srv* syntax itself). The home directory defaults to the debugger installation directory; it can be changed by using the !homedir extension or by setting the DBGHELP_HOMEDIR environment variable. If this subdirectory does not already exist, it will be created.
For information on how to index your sources, or if you plan to create your own source control provider module, see SrcSrv.
Using AgeStore to Reduce the Cache Size
Any source files downloaded by SrcSrv will remain on your hard drive after the debugging session is over. To control the size of the source cache, the AgeStore tool can be used to delete cached files that are older than a specified date, or to reduce the contents of the cache below a specified size. For details, see AgeStore.