Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Fix for #501 and #479 (issues related to pausing a thread with debugger.set_suspend) #508

Merged
merged 2 commits into from
Jun 21, 2018

Conversation

fabioz
Copy link
Contributor

@fabioz fabioz commented Jun 20, 2018

This patch makes sure that:

  • When a thread is suspended the stepping function is properly set (otherwise it may end up not breaking if the function was previously cached to be skipped).
  • pydevd threads are not traced even if the tracing function is set on them.
  • Changes settrace to let users pass where exactly the tracing should pause and use that API to make the pause from ptvsd as the previous approach had some issues if a given function had been previously skipped and currently had no tracing set.

@codecov-io
Copy link

codecov-io commented Jun 20, 2018

Codecov Report

Merging #508 into master will decrease coverage by 0.07%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #508      +/-   ##
==========================================
- Coverage   60.16%   60.09%   -0.08%     
==========================================
  Files          27       27              
  Lines        3673     3666       -7     
==========================================
- Hits         2210     2203       -7     
  Misses       1463     1463
Impacted Files Coverage Δ
ptvsd/attach_server.py 52.17% <0%> (+5.5%) ⬆️
ptvsd/wrapper.py 52.37% <0%> (-0.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33f49c3...2c0f9f2. Read the comment docs.

@fabioz fabioz changed the title Fix for #501 Fix for #501 and #479 Jun 20, 2018
@fabioz fabioz changed the title Fix for #501 and #479 Fix for #501 and #479 (issues related to pausing a thread with debugger.set_suspend) Jun 20, 2018
import sys
pydevd.settrace(
suspend=True,
trace_only_current_thread=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is trace_only_current_thread=True
Why can't and shouldn't we be tracing other threads?

Copy link
Contributor Author

@fabioz fabioz Jun 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break_into_debugger will only make the pause for the current thread.

The method enable_attach is the one responsible for setting the tracing.

-- note: currently, because of the way that Python works, it will only set the tracing for future threads -- there's no API to set the tracing for a running thread from a different thread... not that it's impossible to do: the attach to running process has some utilities to do it, but it's currently not supported in the used APIs and that part from the attach to process needs a better API to handle this).

@karthiknadig karthiknadig merged commit fb27b41 into microsoft:master Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants