2. Why would you want to debug Python and
C++ at the same time?
• Python code uses extension module written in C (or C++, Fortran …)
• To improve performance
• To use some existing library written in that language
• Native application hosts Python for scripting
5. Debugging Python and C++ at the same time
is complicated
• Have to attach two debuggers to the same process
• They are not aware of each other
• So they can only be used one at a time
• And can step on each other’s toes if you’re not careful
• A better way requires integrated, single-debugger experience
7. PTVS debugging features
• Step from Python code into C++, or from C++ into Python
• Set breakpoints in both C++ and Python at the same time
• See and inspect both Python and C++ frames on the stack
• In C++ frames, view Python representation of any PyObject
• In Python frames, view PyObject struct backing any value
• See Python exceptions raised in C right away
8. Limitations
• Native debugger limits what Python debugger can do
• Can’t run Python code inside the process
• Debugger has to directly parse in-memory object representation
• Only types known to debugger have full support
• Limited subset of Python available in Locals, Watch etc
• No special support for numpy (yet)
9. Additional requirements
• Windows only (sorry!)
• Only supports CPython 2.7 and 3.3+
• Needs symbols for python*.dll
• Available for stock Python
• Download from http://python.org
• Installer option in 3.5
• Custom Python distros vary
• If they don’t publish symbols, mixed-mode doesn’t work
• Bug them about it!
11. Try it out today
• Everything you need is FREE!
• Visual Studio Community Edition
http://aka.ms/vs
• Python Tools for Visual Studio
http://aka.ms/ptvs
• PTVS is open source!
https://github.com/Microsoft/ptvs