📜 ⬆️ ⬇️

Debugging: Deploying Debugging Information Server

Digging up deposits of documents on my work computer, I found instructions for deploying a debugging information server that I wrote two or three years ago. I will try to present it to the habrosocommunity. This instruction will be useful for C ++ developers under Windows who want to use debugging of release versions of their product (remotely and directly, on their computers and testers' computers), as well as to do postmortem debugging.


Deploying Debugging Information Store



1. Preparing the environment

To deploy the storage of debugging symbols, you will need:
  1. Computer with Internet access (no matter direct or through proxy), Window 2003 Server operating system or Windows XP Pro, Internet Information Services web server
  2. Distribution Debugging Tools For Windows. The distribution kit can be obtained from the site: www.microsoft.com/whdc/DevTools/Debugging/default.mspx , version x86 or x64
  3. Distributions of operating system symbols. Distributions can be obtained from: www.microsoft.com/whdc/devtools/debugging/symbolpkg.mspx
  4. Distribution proxy server (in the case of direct Internet access)

You should install the Debugging Tools For Windows distribution kit (we will assume that the distribution kit is installed in the “C: \ Program Files \ Debugging Tools For Windows” folder), and install all the debugging symbols of the operating systems in any folder (we assume that they are installed in folder “C: \ TempSymbols”).
')
2. Organization of the debug information store

We will organize the symbol store using Microsoft's symsrv.dll debug information server. To do this, create a folder for the storage of characters, for example C: \ Symbols. Then you should set read permissions for it for any computer users.
The next step is to add debug symbols files to the repository. To do this, use the program “symstore.exe” from the Debugging Tools For Windows kit. Run the following command:
symstore add /r /3 /fc:\TempSymbols\*.* /sc:\Symbols /compress
This command will go through all the subfolders of the “c: \ TempSymbols” directory and copy binary files and files with debug information to the three-level symbol store located in the “C: \ Symbols” folder. Archives them and creates index files to speed up access and store information about access changes to the repository.
Description of the keys of this command:

The command will be executed for a long time and the result of its execution will be the creation of a storage of debugging information in the folder “C: \ Symbols”. After this step, the “C: \ TempSymbols” folder can be deleted.

3. Accessing the debug information repository via the http protocol

At this stage, Internet Information Services should be configured to provide access to the repository. First, create a virtual folder:
  1. Open the “Start-> Administrative Tools-> Internet Information Services (IIS) Manager”.
  2. Expand the folder "Web Sites".
  3. In the context menu of the “Default Web Site“ item, select the item “New-> Virtual Directory ...”
  4. In the welcome window, click “Next”.
  5. In the “Alias” field, enter “Symbols” and click the “Next” button.
  6. In the “Path” field, enter “C: \ Symbols” and press the “Next” button.
  7. Remove the check mark from the “Run scripts” and “Browse” fields.
  8. Click the “Next” and “Finish” buttons.

Next you need to configure the MIME types.
  1. In the context menu of the virtual folder “Symbols”, select “Properties”.
  2. Select the “HTTP Headers” tab.
  3. Click the “MIME Types” button.
  4. Click the “Next” button.
  5. In the field “Extension” we enter “*”.
  6. In the “Mime type” field, enter “application / octet-stream”.
  7. Click the “Ok” button to exit the “MIME Types” window.
  8. Click the “Ok” button to exit the “Properties” window.

4. Installing a proxy filter for updating characters over the Internet

A proxy filter is needed in order for a debugger that does not fail to find the debugging symbol files it needs to take from Microsoft's public repository, thereby performing an update of the symbol repository.
The proxy filter provided by Microsoft in the Debugging Tools For Windows suite is an ISAPI extension and is located in the “C: \ Program Files \ Debugging Tools For Windows \ symproxy” directory.
Install the proxy filter:
  1. Copy the files “symproxy.dll“ and “symsrv.dll“ into the folder “% WINDIR% \ system32 \ inetsrv” from the directory “C: \ Program Files \ Debugging Tools For Windows \ symproxy”.
  2. Create an empty file “% WINDIR% \ system32 \ inetsrv \ symget.yes”.
  3. Enter the data from the file “C: \ Program Files \ Debugging Tools For Windows \ symproxy \ symproxy.reg” into the registry.
  4. Go to the registry editor and find the key “HKLM / Software / Microsoft / Symbol Server Proxy / Web Directories / symbols”.
  5. Change the value of “SymbolPath” to “C: \ symbols; http: //msdl.microsoft.com/download/symbols”.
  6. Next, we register the proxy filter as an event source by creating the registry key “HKLM \ SYSTEM \ CurrentControlSet \ Services \ EventLog \ Application \ SymProxy” and adding a REG_EXPAND_SZ value to it with the name “EventMessageFilter” and value “% WINDIR% \ system32 \ inetsrv \ symproxy.dll ".

Configure IIS to work with a proxy filter:
  1. Open the “Start-> Administrative Tools-> Internet Information Services (IIS) Manager”.
  2. In the context menu of the item “Application Pools, select New-> Application Pool”.
  3. In the “Application ID” field, enter “SymSrv Pool”. And click Ok.
  4. In the context menu of the “SymSrv Pool” item, select the “Properties” item.
  5. Select the “Identity” tab, select the “Predefined” radio button and select “Network Service” in the combo box and press Ok.
  6. Let's deploy the “Web Sites-> Default Web Site” branch.
  7. In the context menu of the “Symbols” item, select the “Properties” item.
  8. On the “Virtual Directory” tab, click the “Create” button.
  9. In the “Application Pool” combo box, select “SymSrv Pool” and click Ok.
  10. In the context menu of “Default Web Site”, select the item “Properties”.
  11. Select the “ISAPI Filters” tab and click the “Add” button.
  12. In the “Filter Name” field we write “SymProxy”, in the “Executable” field we enter “% WINDIR% \ system32 \ inetsrv \ symproxy.dll”.
  13. Click “Ok” to close the “Filter Properties” window.
  14. Click “Ok” to close the “Default Web Site Properties” window.

Run the file “iisreset.exe” to restart IIS with the new settings.

5. Configure proxy server settings for symproxy.dll

Debugging Tools For Windows has a flaw related to the fact that “symproxy.dll” does not redirect calls to receive compressed files of debugging symbols to the Microsoft website if “symproxy.dll” works with the Internet directly (without a proxy server). In order to eliminate this defect, you need to install a local proxy server and use the “proxycfg.exe” utility to configure the system to work with a proxy server.

6. Configuring client computers to work with debug information server

On each client computer (development computer), create a folder for caching characters, for example, “C: \ LocalSymbols”. Install the Debugging Tools For Windows distribution and create environment variables:
_NT_SYMBOL_PATH=srv*[local_repository]*http://[symbol_server_ip]/symbols
_NT_IMAGE_PATH=srv*[local_repository]*http://[symbol_server_ip]/symbols

Where:

The first variable is responsible for the search path for debugging symbols, the second one is for finding binaries that fit these symbols (necessary when parsing crash dumps, i.e. when you do not have direct access to the binaries of the fallen program).

Summary

So, I will describe the result. We now have a server that contains debugging symbols for operating systems and some libraries and Microsoft products. At the same time, if a request is sent to the server to receive characters of some kind of new software version, then this request will be redirected to the Microsoft website, the characters will be downloaded from there and will be sent to your server. On the developers' computers, you will have a local repository of symbols that will be downloaded from your symbol server at the request of the debugger (Visual Studio, WinDbg, etc.). For the completeness of the character server you need only add to your build system:

Conclusion

This instruction, as I said, was written 2-3 years ago, so there appears a computer with Win2003, I think it will not be difficult for you, by analogy, to deploy the character server on Win2008 and the latest version of IIS. Yes, and virtualka, which could take screenshots of the setting, was not there either. But the description is quite detailed, so I think that you will understand.
Perhaps the problem described in paragraph 5 is no longer relevant, I did not check.
More detailed information on working with debug information servers can be obtained from their Debugging Tools For Windows help file, for starters I’ll say that you can also link your debug information server to the source storage server, and then when you analyze crash dump you can see not only the program crash stack, but and a place in the source, valid at the time of assembly.

Source: https://habr.com/ru/post/89094/


All Articles