Symbols for mixed-mode Python/C++ debugging - Visual Studio (Windows) (original) (raw)

This article provides steps to download and integrate debugging symbols for Python interpreters in Visual Studio.

To provide a full debugging experience, the mixed-mode Python debugger in Visual Studio needs debug symbols for the Python interpreter to parse numerous internal data structures. The debugging symbols are defined in program database (.pdb) files. For example, the python27.dll library requires the python27.pdb symbol file, the python36.dll library uses the symbol file python36.pdb, and so on. Each version of the interpreter also supplies symbol files for various modules.

When Visual Studio detects missing required symbols, a dialog prompts you to take action. You typically see the dialog when you start a mixed-mode debugging session. The dialog includes the Open symbol settings dialog link, which opens the Tools > Options dialog to the Debugging > Symbols tab, along with a link to this documentation article.

Screenshot that shows the prompt in Visual Studio to provide the missing required debugging symbols.

Prerequisites

Check your interpreter version

Symbols differ between minor builds of Python and between 32-bit and 64-bit builds. It's important to confirm your version and build of Python to ensure you have the correct symbols for your interpreter.

To check which Python interpreter is in use:

  1. In Solution Explorer, expand the Python Environments node under your project.
  2. Locate the name of the current environment (shown in bold).
  3. Right-click the environment name and select Open Command Prompt Here.
    A command prompt window opens to the install location of the current environment.
  4. Start python by entering the following command:
python.exe  

The execution process displays your installed Python version and indicates whether it's 32-bit or 64-bit:
Screenshot that shows how to use a command prompt opened to the install location of the current environment to detect the Python version.

Download symbols

The following steps describe how to download the required symbols for a Python interpreter.

Point Visual Studio to the symbols

If you downloaded symbols separately, follow these steps to make Visual Studio aware of the symbols.

Note

If you installed symbols by using the Python 3.5 or later installer, Visual Studio finds the symbols automatically. You don't need to complete the steps in this section.

  1. Select Tools > Options, and open the Debugging > Symbols tab.
  2. Select Add (plus symbol) on the toolbar.
  3. Enter the folder path where you extracted the downloaded symbols. This location is where the python.pdb file is located, such as c:\python34\Symbols, as shown in the following image.
    Screenshot that shows the mixed mode debugger symbols options on the Tools Options Debugging dialog.
  4. Select OK.

During a debugging session, Visual Studio might also prompt you for the location of a source file for the Python interpreter. If you downloaded source files, such as from python.org/downloads/, you can point Visual Studio to the downloaded files.

Symbol caching options

The Tools > Options, Debugging > Symbols dialog also contains options to configure symbol caching. Visual Studio uses the symbol caching features to create a local cache of symbols obtained from an online source.

These features aren't needed with the Python interpreter symbols because symbols are already present locally. For more information, see Specify symbols and source files in the Visual Studio debugger.

Access downloads for official distributions

The following table lists download information for official Python version releases.

Python version Downloads
3.5 and later Install symbols through the Python installer.
3.4.4 32-bit - 64-bit
3.4.3 32-bit - 64-bit
3.4.2 32-bit - 64-bit
3.4.1 32-bit - 64-bit
3.4.0 32-bit - 64-bit
3.3.5 32-bit - 64-bit
3.3.4 32-bit - 64-bit
3.3.3 32-bit - 64-bit
3.3.2 32-bit - 64-bit
3.3.1 32-bit - 64-bit
3.3.0 32-bit - 64-bit
2.7.18 32-bit - 64-bit
2.7.17 32-bit - 64-bit
2.7.16 32-bit - 64-bit
2.7.15 32-bit - 64-bit
2.7.14 32-bit - 64-bit
2.7.13 32-bit - 64-bit
2.7.12 32-bit - 64-bit
2.7.11 32-bit - 64-bit
2.7.10 32-bit - 64-bit
2.7.9 32-bit - 64-bit
2.7.8 32-bit - 64-bit
2.7.7 32-bit - 64-bit
2.7.6 32-bit - 64-bit
2.7.5 32-bit - 64-bit
2.7.4 32-bit - 64-bit
2.7.3 32-bit - 64-bit
2.7.2 32-bit - 64-bit
2.7.1 32-bit - 64-bit

Use Enthought Canopy symbols

Enthought Canopy provides debugging symbols for its binaries starting from version 1.2. These symbols are automatically installed alongside with the distribution.

Enthought Canopy 1.1 and earlier and Enthought Python Distribution (EPD), don't provide interpreter symbols. These releases aren't compatible with mixed-mode debugging.