Python symbol files for mixed mode debugging

Dec 19, 2013 at 5:44 AM
I am working on a project which uses a release build of Python 2.7.3. We build python ourselves with a few custom changes on MSVC 2010. However I am not sure how to generate symbol files for it.

Are the symbol files mentioned in the mixed mode debugging page for python 2.7.6 available at http://python.org/ftp/python/2.7.6/python-2.7.6.amd64-pdb.zip for a release/profile/debug build of python?

I know that we can generate the debug symbol files for profile and debug builds but do not know how to do that for a release build. If the symbol files needed above are indeed for a release build how do I generate them?
Coordinator
Dec 19, 2013 at 6:29 AM
The symbols at python.org are for the binaries that go into the official build - that one is Release, naturally. But due to the way VS native debugger works, you need new symbols if you rebuild yourself, even in the exact same configuration and with the exact same source code.

How are you building it? If you're using PC\VS8.0\PCbuild.sln, and building from VS, then you should get the PDBs in that same folder alongside every binary that is built. Note that you only need python27.pdb and _ctypes.pdb for PTVS.
Dec 19, 2013 at 7:59 AM
I am using PCBuild\PCBuild.sln for the release build but I only get python27.dll, python27.exp and python27.pyd. If I try the debug or profile builds I do get the python27_d.pdb and python27.pdb respectively.
I don't think that the release build produces the debug symbol files by default so wanted to know how to modify the release configuration to produce those symbol files.
Coordinator
Dec 19, 2013 at 8:51 AM
Are you sure you haven't tweaked the project file somehow? I just downloaded a fresh copy of python-2.7.3.tar.bz2 just to be sure it's not something I did, and built it in VS (2010 - I don't have 2008 around, unfortunately) in Release. It did produce .pdb files alongside all binaries it made.

The setting is in project properties, under C/C++ -> General, it's called "Debug Information Format".
Dec 20, 2013 at 9:57 AM
Thanks for the help. We do modify the solution files, However I was able to compile python and get the symbol files.

PTVS is now able to load the symbols but when I attach the debugger to a running process, the symbols for my python modules do not get loaded. The MSVC output window shows messages like " Loaded 'Path_to_module\module_name.pyc'. Module was built without symbols.". So the debugger never stops at the breakpionts. I have both the .py and .pyc files at the above locations.
Coordinator
Dec 20, 2013 at 10:20 AM
Python modules don't have symbols in the first place - they're self-describing - hence why those messages show up. They are normal and do not indicate any sort of trouble. If a module appears in the Modules debug tool window with its proper name (which it should, after this message appears), then you should be good to go. You can check by breaking execution using Debug -> Pause, and see if you get the mixed call stack, Python locals etc.

With respect to breakpoints - do they "light up" (i.e. appear solid)?