Debugging: Deploying a Debugging Information Server

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


    Deploying Debug Information Storage



    1. Preparation of the environment

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

    You should install the distribution kit Debugging Tools For Windows (we assume that the distribution is installed in the folder “C: \ Program Files \ Debugging Tools For Windows”), and install all distributions of debugging symbols of operating systems in a folder (we assume that they are installed in folder “C: \ TempSymbols”).

    2. Organization of the debug information storage

    We will organize the symbol storage using the Microsoft debugging server symsrv.dll. To do this, create a folder for the symbol store, for example C: \ Symbols. Next, you should set read permissions on it for any computer users.
    The next step is to add debug symbol files to the repository. To do this, use the “symstore.exe” program from the Debugging Tools For Windows suite. We execute the following command:
    symstore add /r /3 /f c:\TempSymbols\*.* /s c:\Symbols /compress
    this command will go through all the subfolders of the “c: \ TempSymbols” directory and copy binary files and files with debugging information from there to a three-level symbol storage located in the “C: \ Symbols” folder. Archives them and creates index files to speed up access and store information about access transactions for changing the storage.
    Description of the keys for this command:
    • add - add files to the storage.
    • / r - recursively bypass the folder with the symbol files.
    • / 3 - organize a three-tier storage (to speed up access to files)
    • / f [path] - path to the files added to the repository.
    • / s [path] - path to the repository.
    • / compress - create archived storage (to save disk space)

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

    3. Organization of access to the repository of debugging information via the http protocol

    At this point, you should configure Internet Information Services to provide storage access. First, create a virtual folder:
    1. Open “Start-> Administrative Tools-> Internet Information Services (IIS) Manager”.
    2. Expand the folder “Web Sites”.
    3. In the context menu of the “Default Web Site“ element, select “New-> Virtual Directory ...”
    4. In the welcome window, click “Next."
    5. In the “Alias” field, enter “Symbols” and click on the “Next” button.
    6. In the “Path” field, enter “C: \ Symbols” and click on the “Next” button.
    7. Uncheck the “Run scripts” and “Browse” fields.
    8. Click the “Next” and “Finish” button.

    Next, configure the MIME types.
    1. In the context menu of the “Symbols” virtual folder, select the “Properties” punt.
    2. Select the “HTTP Headers” tab.
    3. Click the “MIME Types” button.
    4. Click the “Next” button.
    5. In the “Extension” field, 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 so that the debugger that does not arrive the debugging symbol files it tried to take from the Microsoft public store, thereby updating the symbol store.
    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“ from the “C: \ Program Files \ Debugging Tools For Windows \ symproxy” directory into the “% WINDIR% \ system32 \ inetsrv” folder.
    2. Create an empty file “% WINDIR% \ system32 \ inetsrv \ symget.yes”.
    3. Add the data from the file “C: \ Program Files \ Debugging Tools For Windows \ symproxy \ symproxy.reg” to the registry.
    4. We go into 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, register the proxy filter as an event source by creating the registry key “HKLM \ SYSTEM \ CurrentControlSet \ Services \ EventLog \ Application \ SymProxy” and adding the REG_EXPAND_SZ value with the name “EventMessageFilter” and the value “% WINDIR% \ system32 \ inetsrv \ symproxy.dll "

    We configure IIS to work with a proxy filter:
    1. Open “Start-> Administrative Tools-> Internet Information Services (IIS) Manager”.
    2. In the context menu of the “Application Pools” item, 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” element, select “Properties”.
    5. Select the “Identity” tab, select the “Predefined” radio button and select “Network Service” in the combo box and press Ok.
    6. Expand the branch “Web Sites-> Default Web Site”.
    7. In the context menu of the “Symbols” element, select “Properties”.
    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 “Default Web Site” context menu, select “Properties”.
    11. Select the “ISAPI Filters” tab and click the “Add” button.
    12. In the field “Filter Name” we write “SymProxy”, in the field “Executable” 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 “iisreset.exe” file to restart IIS with the new settings.

    5. Configuring proxy server settings for symproxy.dll

    There is a drawback in Debugging Tools For Windows that “symproxy.dll” does not redirect calls to receive compressed debugging symbol files to the Microsoft website if “symproxy.dll” works directly with the Internet (without a proxy server). In order to eliminate this defect it is necessary 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 the debug information server

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


    • [local_repository] is the local character cache, for example, “C: \ Symbols”.
    • [symbol_server_ip] - IP address or domain name of the corporate debug information server.

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

    Summary

    So, I will describe the result. We now have a server on which debugging symbols of operating systems and some Microsoft libraries and products are located. At the same time, if an appeal is received to the server for receiving the characters of some new version of the software, then this request will be redirected to the Microsoft website, the characters will be downloaded from there and will be downloaded to your server. On developers' computers, you will have a local symbol repository organized, which will be downloaded from your symbol server at the request of the debugger (Visual Studio, WinDbg, etc.). To complete the work of the character server, you only need to add to your build system:
    • setting up the creation of debugging information files (* .pdb)
    • calling symstore to get debugging information about your components and the components themselves to your server.

    Conclusion

    This instruction, as I said, was written 2-3 years ago, so there is a computer with Win2003 there, I think it will not be difficult for you to deploy the symbol server on Win2008 and the latest version of IIS by analogy. And there were no virtual machines on which screenshots of the settings could be taken. 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 debugging information servers can be found in their help file Debugging Tools For Windows, for seed I’ll say that you can still bind your debugging information server to the source storage server, and then when parsing the crash dump you can see not only the program crash stack, but and a place in the source code, valid at the time of assembly.

    Also popular now: