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

Breakpoint and Step Over with multithreading #515

Closed
pub-pub opened this issue Dec 9, 2024 · 4 comments
Closed

Breakpoint and Step Over with multithreading #515

pub-pub opened this issue Dec 9, 2024 · 4 comments
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@pub-pub
Copy link

pub-pub commented Dec 9, 2024

there's an issue with debugging python code that utilizes multithreading.
i set a breakpoint, start debugging, execution pauses as expected, but when i press 'Step Over' (F10) debugger does not go to the next expression (line) in the current thread, but jumps to some random locations in other running threads, and i have to 'Step Over' again and again until i return to my current thread.

'Step Over' feature must be limited the current (paused) thread.

the same issue was reported for Visual Studio a couple of years ago https://developercommunity.visualstudio.com/t/make-the-debugger-stick-to-the-current-thread-inst/351390

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 9, 2024
@karthiknadig
Copy link
Member

@pub-pub in debugpy the library there is a setting for this. Try adding this to the launch config: "steppingResumesAllThreads": false

@pub-pub
Copy link
Author

pub-pub commented Dec 9, 2024

@pub-pub in debugpy the library there is a setting for this. Try adding this to the launch config: "steppingResumesAllThreads": false

thanks a lot, @karthiknadig
it's working great

but i had to hardcode False into pydevd_process_net_command_json.py because i don't know where exactly i should put "steppingResumesAllThreads": false in launch.json. can you, please, explain it to me?

and one more thing: maybe there's also a parameter that keeps me Stepping Over inside my thread without pausing all other threads?

@karthiknadig
Copy link
Member

maybe there's also a parameter that keeps me Stepping Over inside my thread without pausing all other threads?

@pub-pub debugpy has lot more control over this, but I am not sure if there is a stop only current option yet. This might be a feature request on debugpy. You can ask for it here https://github.com/microsoft/debugpy

@karthiknadig
Copy link
Member

but i had to hardcode False into pydevd_process_net_command_json.py because i don't know where exactly i should put "steppingResumesAllThreads": false in launch.json. can you, please, explain it to me?

       {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "steppingResumesAllThreads": false
        }

Even though it has the yellow line it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants