Using SrcSrv

To use SrcSrv with WinDbg, KD, NTSD, or CDB, verify that you have installed a recent version of the Debugging Tools for Windows package (version 6.3 or later). Then, include the text srv* in the source path, separated by semicolons from any directories that are also in the source path.

For example:

.srcpath srv*;c:\someSourceCode

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.

If a source file is retrieved by SrcSrv, it remains 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 Debugging Tools for Windows installation directory; it can be changed by using the !homedir extension or by setting the DBGHELP_HOMEDIR environment variable. If the src subdirectory of the home directory does not already exist, it is created.

Debugging SrcSrv

If you experience any trouble extracting the source files from the debugger, start the debugger with the -n command-line parameter to view the actual source extraction commands along with the output of those commands. The !sym noisy command does the same thing, but you may have already missed important information from previous extraction attempts. This is because the debugger gives up trying to access source from version control repositories that appear to be unreachable.

Retrieving Source Files

If you use the .open (Open Source File) command to open a new source file through SrcSrv, you must include the -m Address parameter.

To facilitate the use of SrcSrv from tools other than the debuggers listed previously, the DbgHelp API provides access to SrcSrv functionality through the SymGetSourceFile function. To retrieve the name of the source file to be retrieved, call the SymEnumSourceFiles or SymGetLineFromAddr64 function. For more details on the DbgHelp API, see the dbghelp.chm documentation, which can be found in the sdk/help subdirectory of the Debugging Tools for Windows installation directory, or see Debug Help Library on MSDN.

Using AgeStore to Reduce the Cache Size

Any source files downloaded by SrcSrv 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.



Send comments about this topic to Microsoft

© 2015 Microsoft