PTVS
PTVS copied to clipboard
Can't step into Python or set Python breakpoints from C++
This issue has been moved from a ticket on Developer Community.
It does not seem possible to step through a C++ program that calls Python using embedded Python.
The attached example shows the issue. The test.cpp file initialises Python (linked to python38.dll) and then calls a Python function defined in test_py.py. You can set a breakpoint in C++ (e.g. line 84, PyObject_Call) with the python/native debugger set, and it will break just fine. If you then try and step into the python function, or set a preakpoint in the python file, the debugger ignores it.
I have managed to get things to work by running a process then attaching the debugger to it and breaking into Python code. But this is usually not helpful as it seems the python code has to be running before you can attach to it, and by that time it's too late to be useful.
I hope this can be fixed - and documented - soon, as it severely limits debugging mixed C++/Python code. The example project is attached.
Original Comments
Feedback Bot on 7/15/2022, 02:43 AM:
(private comment, text removed)
Original Solutions
(no solutions)
can you update VS to the latest version?
Going to close this out. If the issue still persists, please reopen with the information requested. Thanks.😊