Monday, January 20, 2014

Setting up Microsoft symbol Server to debug using windbg

What are Symbols?
Symbol is a name assigned to a location in memory.  In case of private symbol they include function name, type, parameter, variables and line number.

Public symbols do not include the line number and local variables.

How to reference the Microsoft Symbol Server to obtain symbol debugging information?
The Microsoft Symbol Server is built by using the SymSrv technology (SymSrv.dll) that is provided with the Debugging Tools for Windows package. SymSrv builds a local symbol cache for fast, automatic symbol resolution.

It is as simple to use the Symbol Server as it is to use the appropriate syntax in your symbol path. Typically, the syntax takes the following format:
SRV*your local symbol folder*http://msdl.microsoft.com/download/symbols
where your local symbol folder is any drive or share that is used as a symbol destination.

For example, to set the symbol path in the WinDbg debugger, type the following command in the command window of the debugger:
.sympath SRV*f:\localsymbols*http://msdl.microsoft.com/download/symbols
 

Setting the _NT_SYMBOL_PATH environment variable

The common Microsoft debugging tools use the SymSrv technology if you provide the correct symsrv syntax in the _NT_SYMBOL_PATH environment variable. These tools automatically include whatever you provide in the variable as the symbol path.

You can set this variable as a system variable or as a user environment variable. To do this from the desktop, right-click My Computer, and then click Properties. On the Advanced tab, click Environment Variables.

You can also set this variable temporarily at a command prompt. In this way, all applications that you start through the command prompt inherit this setting. For example:
Set _NT_SYMBOL_PATH = symsrv*symsrv.dll*f:\localsymbols*http://msdl.microsoft.com/download/symbols
 

Using the Microsoft Symbol Server with WinDbg

To use the Symbol Server Web site from within WinDbg, follow these steps:
  1. Start the Windows Debugger (WinDbg.exe).
  2. On the File menu, click Symbol File Path.
  3. In the Symbol path box, type the following command:
    SRV*your local folder for symbols*http://msdl.microsoft.com/download/symbols
    where your local folder for symbols is the folder in which you copy your local symbol cache. The debug symbols are downloaded to this location.

    Note You can point to any local path or share that your computer can reach; it does not have to be a location on the computer's hard disk.
Alternatively, you can also use the .sympath command at a command prompt to set the symbol path.

You can combine the symsrv syntax with other symbol paths. For example, use the following syntax to specify two or more symbol paths:
f:\MySymbols;SRV*f:\localsymbols*http://msdl.microsoft.com/download/symbols

No comments:

Post a Comment