Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have to step multiple times when "stepping in" with justMyCode=true #1104

Closed
roblourens opened this issue Oct 26, 2022 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@roblourens
Copy link
Member

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.6.3
  • OS and version: macOS
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.5
  • Using VS Code or Visual Studio: VS Code

From microsoft/vscode-jupyter#11774

  • "jupyter.debugJustMyCode": true,
  • use the snippet below
  • press step into on line 5
  • 🐛 you need to press step into a couple of times before it resumes on the next line
import ipywidgets as widgets

print(12)

a = widgets.IntSlider(description='a')
a

@fabioz I assume this comes from the way ipython executes code one line at a time- is it possible for a single "step in" to advance to the next line when justMyCode is enabled, the same way it does when debugging a normal python script?

Lmk if you want debugpy logs for this, I'd be happy to grab them.

@fabioz
Copy link
Collaborator

fabioz commented Oct 27, 2022

I can reproduce this. It's the same issue related to IPython because each new line is a completely new frame.

I'll have to investigate how to improve this on the step in (but I have some other issues I'll need to tackle first).

@int19h int19h added the bug Something isn't working label Nov 1, 2022
@roblourens
Copy link
Member Author

Actually this isn't just about what happens when a user uses "step in" while debugging, this is almost a deal breaker for vscode's "run by line" experience. We give users one button to step through all the code in their cell, and so we always issue a stepIn. So now if they use RBL on a cell with print statements, they are stuck clicking multiple times to progress. Can you think of any workaround for us?

@roblourens
Copy link
Member Author

To be clear, this only happens when PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING = '1'; is set. If we can't get a workaround here, we probably have to back out the change to enable justMyCode in notebooks.

I'm wondering whether it's safe to do a hack like, if the user is using Run By Line and we pause in the exact same position of the last pause, we automatically issue a step-over. Do you think that would be a safe workaround or is there a legit situation where that would happen, like in debugging some kind of loop?

@fabioz
Copy link
Collaborator

fabioz commented Nov 17, 2022

I think that it'd be a reasonable workaround (although maybe doing a step in until it changes the position vs a step over might be better to make sure you don't accidentally go over some code which should've been a step in and not a step over) ... as a note, I'm taking a look at the gevent breakage (which broke debugging in the latest update) and my plan is taking a look at this one afterwards.

@roblourens
Copy link
Member Author

Thanks! In a test, it seemed that when I step through a list comprehension, I pause at the same position multiple times, so that might not give perfect results, but might still be an acceptable compromise if needed.

@fabioz
Copy link
Collaborator

fabioz commented Nov 18, 2022

I'll start to take a look at this (note: I'll probably only finish next week).

fabioz added a commit to fabioz/debugpy that referenced this issue Nov 25, 2022
fabioz added a commit to fabioz/debugpy that referenced this issue Nov 25, 2022
@int19h int19h closed this as completed in 9e94581 Nov 28, 2022
@roblourens
Copy link
Member Author

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants