Windbg Symbol path configuration

This part¬† “Windbg Symbol path – Part 2” will be dedicated to Symbol path configuration in Windbg , through command prompt and global configuration of Symbol path for all Windows Tools.

Regarding¬†definition, verification of Windbg tool installation ,first look of windbg and impact on analysis if windbg symbol path is not configured ,you can read the previous post title ”¬†Windbg Symbol path – Part 1” .

Windbg symbol path is

http://msdl.microsoft.com/download/symbols

which is non-browse-able. Since the symbol server is build by using the SymSrv technology which builds a local symbol cache for fast, automatic symbol resolution.

So, provide the below mentioned syntax in the tool at appropriate place

SRV*Your-Local-Path*http://msdl.microsoft.com/download/symbols

Here <Your-Local-Path> is such as C:\symbols or D:\symbolfolder means you need to specify the fully-qualified path of your local directory which will be used as cache.

So, In my case I am using a Directory named “Symbols” in my C: drive. The symbol path in the windbg tool will look like

SRV*C:\symbols*http://msdl.microsoft.com/download/symbols

Windbg Symbol path

Windbg Tool with symbol configured

 

In case, if the syntax or path will be wrong or other than the mentioned above will give you symbol error as mentioned in the previous post.

In case you want to provide the symbol path inside command windows of the debugger. You can do this by running the below mentioned command.

[Again I would like to mention you can change your preferred location as I have used mine as C:\Symbols]

.sympath SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

So far we learnt about the configuration of Symbol path in windows debugger. What if I want to set the symbol path for all the application which will be using it.

Yes you can do it . There are 2 method which will help you to achieve it.

Method 1 : Temporary Symbol Path Configuration

STEP 1 : Open CMD as an administrator.
STEP 2 : Execute

Set _NT_SYMBOL_PATH = symsrv*symsrv.dll*C:\Symbols*http://msdl.microsoft.com/download/symbols

or

Set _NT_SYMBOL_PATH = SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

STEP 3 : Execute your application through the command prompt.

Note: If CMD is closed , you will need to execute the same command again in other command prompt and then run the application from the same command prompt.

Method 2 : Permanent Symbol Path Configuration

STEP 1 : Open Environmental Variable for configuring a new variable.

To do this from desktop, right-click My Computer, and then click Properties. On the Advanced tab, click Environment Variables.

STEP 2 : Click on New, under System Variables which is at the lower section .

STEP 3 : Put Variable name as _NT_SYMBOL_PATH
STEP 4 : Put Variable value as SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
STEP 5 : Click on OK trice.
STEP 6 : Start your application.

windbg symbol path

Symbol Path in Environment Variable

What if a developer wants to use his own symbols for an application developed by him along with Windows Symbol path for better understanding of his program or application.

That’s really very simple, in any of the above mentioned method while providing symbole path use semicolon and put your symbol path .

For example, adding another local symbol path which is in D: drive in the LocalAppSymbol folder

_NT_SYMBOL_PATH = D:\LocalAppSymbol;SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

or

In environment variable settings

Put Variable name as _NT_SYMBOL_PATH
Put Variable value as D:\LocalAppSymbol;SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

Important part of this symbol setting is that the required symbols will be downloaded as and when needed . So the good part your space and bandwidth is saved. Bad part is that time will get consumed while downloading every-time if you are using different OS version and kernel flavor.
So if you need to download symbol files for all the components in the windows/system32 folder you can use SymChk.exe utility by running the command in administrative mode

symchk /r c:\windows\system32 /s SRV*c:\Symbols\*http://msdl.microsoft.com/download/symbols

Here
symchk is the utility in the location where you have installed the windows debugging tools.
/r c:\windows\system32 finds all symbols for files in the System32 folder and any subfolders with in System32.
/s SRV*c:\symbols*http://msdl.microsoft.com/download/symbols specifies the symbol path to use for symbol resolution.

In this case, c:\Symbols is the local folder where the symbols will be copied from the symbol server http://msdl.microsoft.com/download/symbols .

In order to understand more regarding symchk you can write your request in comment or simply type “symchk /?“.