Quantcast
Channel: C#
Viewing all articles
Browse latest Browse all 1853

Using Debug Information

$
0
0

Intel® VTune™ Amplifier requires debug information for the binary files it analyzes. To obtain accurate performance data and enable source analysis, make sure to:

On Windows* operating systems, debug information is provided in PDB files. Make sure both your system and application libraries/executable have PDB files. Compile your target with optimizations and start profiling its performance.

By default, the Microsoft Visual Studio* IDE does not generate PDB information in the Release mode. For better results with the VTune Amplifier, enable symbol generation manually. For system libraries, use the Microsoft* Symbol Server to download the required PDB files from the Microsoft* web site. Follow the steps below to ensure the VTune Amplifier uses debug information for both system and your own libraries.

Debug Information for System Libraries

To download the debug information for system libraries, use one of the following options:

Option 1. Configure the Microsoft* Symbol Server from Visual Studio:

Note

The instructions below refer to the Microsoft Visual Studio* 2013 integrated development environment (IDE). They may slightly differ for other versions of Visual Studio IDE.

  1. Make sure you have Internet connection available on your machine.

  2. Go to Tools > Options....

    The Options dialog box opens.

  3. From the left pane, select Debugging > Symbols.

  4. In the Symbol file (.pdb) locations field, select the Microsoft Symbol Servers option, typically provided by default, or click the button and add the following address to the list: http://msdl.microsoft.com/download/symbols.

  5. Make sure the added address is checked.

  6. In the Cache symbols in this directory field, specify the directory where the downloaded symbol files will be stored.

    Note

    If you plan to download symbols from the Microsoft symbol server only once and then use local storage, use the following syntax for the cache directory: srv*<local_dir>. For example: srv*C:\Windows\symbols.

    See the example below:



  7. Click OK to close the dialog box.

    For newly collected results, the VTune Amplifier downloads debug information for system libraries automatically while finalizing the results. For previous results, however, you need to re-finalize the results so that the VTune Amplifier can download the debug information for system libraries. To start re-finalizing the result, right-click the result node in the Solution Explorer and choose Re-resolve and Open.

Note

If you use the symbol server, the finalization process may take a long time to complete the first time the VTune Amplifier downloads the debug information for system libraries to the local directory specified in the Options (C:\Windows\symbols in the example above). Subsequent finalizations should be faster.

Option 2. Configure the Microsoft symbol server from the VTune Amplifier standalone client:

  1. Click the Configure Project button on the toolbar.

    The Choose Target and Analysis Type window opens with the Analysis Target tab active.

  2. Click the Binary/Symbol Search button on the right.

  3. Add the following string to the list of search directories:

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

    where local_symbols_cache_location is the location of local symbols. The debug symbols for system libraries will be downloaded to this location.

    Note

    If you specify different directories for different projects, the files will be downloaded multiple times, adding unwanted overhead. If you have a Visual Studio project that defines a cache directory for the symbol server, use the same directory in the standalone VTune Amplifier so that you do not waste time and space downloading symbols that already exist in a cache directory.

Option 3. Set the environment variable:

Set the environment variable (system or user) _NT_SYMBOL_PATH to srv*C:\local_symbols_cache_location*http://msdl.microsoft.com/download/symbols .

Note

VTune Amplifier does not automatically search the Microsoft symbol server for debug information for system files since this functionality:

  • Requires an internet connection. Some users are collecting and viewing results on isolated lab systems and do not have internet access.

  • Adds an overhead to finalization of the collection results. For each module without debug information on the local system, a request goes out to the symbol server. If symbols are available, additional time is required to download the symbol file.

  • Uses additional disk space. If symbols for system modules are not used, this disk space is wasted.

  • May be unwanted. Many users do not need to examine details of time spent in system calls and modules. Automatically downloading symbols for system files would be wasteful in this case.

Debug Information for Application Binaries

To generate debug information for your binary files:

  1. Right-click your C++ project and select the Properties item in the context menu.

    The <your_project>Property Pages dialog box opens.

  2. From the Configuration drop-down list, choose the Release configuration.

    It may be already selected if your current configuration in the Visual Studio environment is Release.

  3. From the left pane, select Configuration Properties > C/C++> General.

  4. In the Debug Information Format field, choose Program Database (/Zi).

  5. From the left pane, select Configuration Properties > Linker > Debugging.

  6. In the Generate Debug Info field, choose Yes (/DEBUG).

  7. Click OK to close the dialog box.

  8. Rebuild your solution.

Note

If you configured Visual Studio to generate debug information for your files, you cannot "fix" previous results because the executable and the debug information do not match the executable you used to collect the old results.

To enable generating the debug information with MinGW/Cygwin GCC* compilers:

Use -g option or -gdwarf-version (for example: -gdwarf-2, -gdwarf-3) if DWARF is not a default debugging information format.

To generate a native .PDB file for a native image of .NET* managed assembly:

Use the Native Image Generator tool (Ngen.exe) from the .NET Framework. Make sure the search directories, specified in the Binary/Symbol Search dialog box, include path to the generated .pdb file.

Check the Results

If your system and application modules have debug information, the VTune Amplifier is able to provide full-scale statistics on call stacks, source data, and so on. For example, you may use the Call Stack Mode on the filter toolbar to select the User/system functions option and view data on both user and system functions.

If the VTune Amplifier does not find debug information for the binaries, it statically identifies function boundaries and assigns hotspot addresses to generated pseudo names func@address for such functions, for example:

If a module is not found or the name of a function cannot be resolved, the VTune Amplifier displays module identifiers within square brackets, for example: [vmlinux].

If the debug information is absent, the VTune Amplifier may not unwind the call stack and display it correctly in the Call Stack pane. Additionally in some cases, it can take significantly more time to finalize the results for modules that do not have debug information.


Viewing all articles
Browse latest Browse all 1853

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>