Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Behavior of next / stepOver #144

Open
jtpio opened this issue Nov 4, 2019 · 9 comments
Open

Behavior of next / stepOver #144

jtpio opened this issue Nov 4, 2019 · 9 comments
Milestone

Comments

@jtpio
Copy link
Member

jtpio commented Nov 4, 2019

We should check what it happening when the stepOver (next) command is being used.

In the screencast below we would expect to advance to the line 2, then 3 and then 4 when doing several calls to stepOver.

step-over-behavior

@jtpio jtpio added this to the 0.0.1 milestone Nov 5, 2019
@jtpio jtpio self-assigned this Nov 7, 2019
@jtpio
Copy link
Member Author

jtpio commented Nov 7, 2019

One difference compared to VS code is that we always seem to have one more scope frame on line 2. Which would explain why the next command will add that "extra jump":

step-over-behavior-2

@jtpio
Copy link
Member Author

jtpio commented Nov 7, 2019

As a side-effect, we can continue breaking and stepping even after removing the breakpoints:

step-over-behavior-3

@jtpio
Copy link
Member Author

jtpio commented Nov 7, 2019

@JohanMabille
Copy link
Member

I wonder if this behavior does not come from the way we initialize ptvsd. Indeed, I can observe the same behavior even if the last statement is not an expression to evaluate. I've also played a bit with the backend, the following change doe snot fix the issue:

    std::string filename = get_cell_tmp_file(code);
    register_filename_mapping(filename, execution_count);
    
    // Parse code to AST
    py::object code_ast = ast.attr("parse")(code, filename, "exec");
    py::list expressions = code_ast.attr("body");

@jtpio
Copy link
Member Author

jtpio commented Nov 8, 2019

I wonder if this behavior does not come from the way we initialize ptvsd

That is also one possibility yes.

@JohanMabille
Copy link
Member

This issue is definitely due to the backend implementation. It seems that ptvsd doe snot support interactive mode yet (see microsoft/ptvsd#201).

The result is that we have too stackframes, one from the interactive mode and one from the code that hit the breakpoints. When we reach the end of the file containing the code of the cell, it comes back to the interactive frame. This is the same behavior when the code is stoppe don the last line of a funciton and we click the next button: it commes back to the call site.

@jtpio
Copy link
Member Author

jtpio commented Nov 18, 2019

Related PR in xeus-python: jupyter-xeus/xeus-python#169

@jtpio
Copy link
Member Author

jtpio commented Nov 18, 2019

jupyter-xeus/xeus-python#169 already is a good improvement for the behavior of next / stepOver. Thanks @JohanMabille for this!

However there seems to be something else related to the status of kernel (busy / idle) when the execute_request has completed:

step-over-behavior-4

Leaving the issue open so we can track this.

@jtpio jtpio removed their assignment Nov 18, 2019
@jtpio
Copy link
Member Author

jtpio commented Dec 12, 2019

Moving that one to the next release as this is not a blocker for 0.1.0.

@jtpio jtpio modified the milestones: 0.1.0, 0.2.0 Dec 12, 2019
@jtpio jtpio modified the milestones: 0.2.0, Future Mar 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants