PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

Step into from Python to C++ doesn't work if arguments are unpacked into function call

Open vsfeedback opened this issue 2 years ago • 2 comments

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice] It seems that in a mixed-mode Python/C++ debugging session, while debugging a piece of Python code, stepping into a function whose implementation is in C++, this does not work if the arguments are unpacked into the function call.

Example:

fast_foo(1, 2, 3)  # works, I manage to step into the C++ code

args = (1, 2, 3)
fast_foo(*args)  # does not work, it instead steps over the function call

A work around seems to be to either set a break point in the C++ code, or to change the calling code:

args = (1, 2, 3)
fast_foo.__call__(*args)

For some reason, using the __call__ method seems to not suffer from the problem. However, both of these work arounds are not really satisfactory.


Original Comments

(no comments)


Original Solutions

(no solutions)

vsfeedback avatar Aug 18 '22 16:08 vsfeedback

Likely due to code not keeping up with various possible step-in code flows in newer versions of Python.

int19h avatar Aug 30 '22 06:08 int19h

Relevant code parts:

https://github.com/microsoft/PTVS/blob/421d001d433ab8f05b210dad10a54807af5ea6ff/Python/Product/Debugger.Concord/TraceManagerLocalHelper.cs#L220-L223

https://github.com/microsoft/PTVS/blob/421d001d433ab8f05b210dad10a54807af5ea6ff/Python/Product/Debugger.Concord/TraceManagerLocalHelper.cs#L539-L813

So basically there's some code path that handles the CALL_... bytecode opcodes that either doesn't go through any of these, or if it does, it doesn't set a breakpoint on some of the potential destinations.

int19h avatar Aug 30 '22 22:08 int19h