Setting up a public (or private) symbol server over http
I believe the answer is a very simple, "Just share the directory via some sort of http path." According to Chad Austin's entry on "Creating Your Very Own Symbol Server", this will just work.
In other words, the directory which symstore.exe
uses to store the symbols, when served up as http://symbols.example.com/public_symbols/ , will be usable as the symbol server target for the Windows Debugging Tools.
How to set up symbols in WinDbg?
Symbols can be set up correctly in various different ways.
WARNING: The examples here use \\server\symbols
which is typically a network storage that is not available. Adapt it to your local server or leave that part out completely if you don't have one. A non-existent server may cause delays etc.
TLDR version for 80% of the cases
Create a new folder c:\symbols
for symbols provided by Microsoft. Then type
.symfix+ c:\symbols
.reload
(or reload -f
if necessary)
Make sure you have an Internet connection, since this will contact some Microsoft servers and download symbols from there.
In 80+% of the cases, this might already solve your symbols problem. If not, read on.
Fixing symbols by commands
WinDbg will look for symbols in the order they appear in the symbol path. Therefore it's a good idea to put your local symbols first, then some company local network share and then download symbols from the Internet and store a copy locally.
.sympath c:\mysymbols ; *** Symbols of your application, locally, flat list of PDB files
.sympath+ cache*c:\symbolcache ; *** (optional) Create a cache for everything
.sympath+ \\server\symbols ; *** Symbols provided from a network share
.symfix+ c:\symbols ; *** Microsoft symbols
Fixing symbols by menu
In WinDbg (but not the command line equivalents) you can set a symbol path by File/Symbol File Path...
or pressing Ctrl+S. You enter it in the following format
c:\mysymbols;cache*c:\symbolcache;\\server\symbols;SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Fixing symbols by command line
WinDbg also takes the -y
command line switch if you prefer having different desktop links with different symbol path setups.
WinDbg -y "<symbol path>"
Note that you need the complete path here, which is in a form like
c:\mysymbols;cache*c:\symbolcache;\\server\symbols;SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Fixing symbols by environment variable
There is a environment variable called _NT_SYMBOL_PATH
which can be set to a symbol path as well. Use the following syntax:
c:\mysymbols;cache*c:\symbolcache;\\server\symbols;SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Note that not only WinDbg evaluates this variable, but also Visual Studio, Process Explorer, Process Monitor and potentially other software. You may experience performance impact setting this environment variable.
Saving the symbol path as part of a workspace
If you have a rather complex symbol setup which includes several paths, become familiar with the concept of WinDbg workspaces.
Workspaces allow you to save the symbol path so you don't have to re-type all the commands in every debugging session.
Once you're satisfied with the workspace, create a link for WinDbg to include -Q
which means " Suppress the annoying "Save workspace?" question".
So far I'm very happy having save the symbols as part of the Base
workspace.
Deferred symbols
Deferred symbols (indicated as such during a lm
command) are not a problem. WinDbg will load them whenever needed. To force loading all of them, type
ld*
Debugging symbol issues
If the symbols (PDBs) do not work as expected, use the
!sym noisy
to get more information about what WinDbg is exactly doing when resolving symbols.
When you found the solution, turn it off with
!sym quiet
To check individual symbols for correctness, you can use the symchk
tool which comes with WinDbg.
Symchk /if <exe> /s <symbol path> /av /od /pf
/if = input is a file
/s = symbol file path
/od = all details
/av = verify
/pf = check if private symbols are available
or get ChkMatch which is a bit easier to use
ChkMatch -c <exe file> <pdb file>
If you have trouble accessing symbols from a network share, make sure you logged on to the network share before. AFAIR, WinDbg does not ask for credentials.
Official documentation
Use the Microsoft Symbol Server to obtain debug symbol files (should redirect here but redirection is currently broken)
Symbol path for Windows debuggers
How to load all Windows Symbols from server, starting with W10 version 1803 / build 17134?
Run this command to get all PDBs for all Windows files:
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\symchk.exe" /r c:\windows /s SRV*c:\symbols\*http://msdl.microsoft.com/download/symbols
How operate and update a symbol server for Microsoft Windows on a closed network?
Another option to populate your 'closed network symbol' store is to use symchk this way :
go on the target machine (the one you want the symbols). Install windbg and run the command
symchk /r c:\windows\*.dll /om c:\symbols.txt
on a machine connected to the internet, retreive the symbols.txt file generated and use the same symchk :
symchk /im c:\temp\symbols.txt
In the first step, symchk will generate a text file with the signatures of the binaries of the target machine. In the second step, this list is read and symchk actually retreives the pdb files from the Microsoft Symbol Server.
IDebugSymbols doesn't find symbols in symbol server
You should get windows debugging tools ( from Windows Kits now ) and use components
dbgeng.dll, dbghelp.dll and symsrv.dll from it. OS has standard version of these dll in System32 and unfortunately they has restricted functions. For example they dont support symbol servers on windows 7.
may be you find our projects usefull:
kdlibcpp
pykd - python wrapper for kdlibcpp
For example this code print out current stack:
StackPtr stk = getStack();
for ( int i = 0; i < stk->getFrameCount(); ++i )
dprintln( findSymbol( stk->getFrame(i)->getIP() ) )
Windows Symbol server
That setting is only appropriate if you use the environment variable. I'm pretty sure from previous questions that you actually use Visual Studio. The MSDN page is here. Or press F1 when you've got the dialog up.
Related Topics
Error: Member Access into Incomplete Type:Forward Declaration Of
Debugging Information Cannot Be Found or Does Not Match Visual Studio'S
How to Store Arrays in an Stl List
How to Get a List of Video Capture Devices (Web Cameras) on Windows? (C++)
How Does *(&Arr + 1) - Arr Give the Length in Elements of Array Arr
"Constexpr If" VS "If" with Optimizations - Why Is "Constexpr" Needed
Non-Defaulted Operator <=> Doesn't Generate == and != in C++20
Using Vector<Char> as a Buffer Without Initializing It on Resize()
Why am I Getting an Error Converting a 'Float**' to 'Const Float**'
Why Is a Char and a Bool the Same Size in C++
Cmake Find_Package Specify Path
Why Do We Need a Virtual Table
C/C++ Source Code Visualization
How to Convert Utf-8 Std::String to Utf-16 Std::Wstring
Source Code of C/C++ Functions
Is It Counter-Productive to Pass Primitive Types by Reference