Symbols for Python mixed-mode debugging

What exactly do I need, and why?

Python mixed-mode debugger needs to be able to parse numerous internal data structures within Python interpreter being debugged. In order to do so consistently for all supported versions of Python, it needs debug symbols for the Python interpreter. In particular, symbols are required for:
  • The main interpreter DLL (python27.dll, python33.dll, python27_d.dll or python33_d.dll, depending on version of the interpreter, and whether it is a Py_DEBUG build of it).
  • CTypes (ctypes.pyd or ctypes_d.pyd), if you want to be able to step into functions imported via ctypes.

A symbol file for a given binary has the same name with .pdb extension. For example, a symbol file for python27.dll will be named python27.pdb.

Where to download symbols

If you are using the reference Python interpreter downloaded from the official Python website at, then you can download symbols from the same website. To do so, you should open the detailed release page for your Python version, and locate a link described as "Windows x86 MSI program database" (for 32-bit interpreter) or "Windows X86-64 program database" (for 64-bit interpreter). Below are direct download links for all supported versions:

All these downloads are in form of a .zip file containing the requisite .pdb files. After downloading it, unpack it to any directory, and follow the instructions below on registering them with Visual Studio.

If you're using a third-party Python distribution such as ActiveState Python, you will need to contact the authors of that distribution to provide you with symbols. One exception is WinPython, which incorporates the stock Python interpreter; you should use one of the links above for the corresponding version number (e.g. for WinPython, get symbols for Python 2.7.5).

Enthought Canopy 1.1 does not provide interpreter symbols, and is therefore not compatible with mixed-mode debugging. The upcoming version 1.2, to be released in November 2013, will have such support.

Registering symbols with Visual Studio

After you have obtained the .pdb files for your interpreter, you should make Visual Studio aware of them, so that it automatically loads them whenever you start debugging. To do so, open Visual Studio, and navigate to Tools -> Options in the main menu, then to Debugging -> Symbols in the dialog that opens. You should see something like this:


Now you need to add the folder in which .pdb files reside to the location list. To do so, click on the "Add" button (first from the left in the row of buttons above the list), and then enter the folder path in the textbox that appears. Click "OK" to close the dialog.

Next time you will start debugging a Python application with mixed-mode debugger, the symbols will be located and loaded, and it will be possible to debug Python code.

Last edited Dec 5, 2013 at 8:32 PM by pminaev, version 10


No comments yet.