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
pdb docs need to contain a statement on threads/multithreaded debugging #67352
Comments
Due to the fact that |
pdb does not ignore breakpoints which are set and hit in a non-main thread. $ python pdb_thread.py
> pdb_thread.py(5)foo()
-> lineno = 5
(Pdb) break 6
Breakpoint 1 at pdb_thread.py:6
(Pdb) continue
> pdb_thread.py(6)foo()
-> lineno = 6
(Pdb) threading.current_thread().name
'fooThread'
(Pdb) |
The pdb documentation could make an explicit reference to the documentation of sys.settrace() where it is explained that the function is thread specific. |
My initial description was imprecise. Clearification: The fact that in
import threading
def debugging():
def __a_thread__():
print("2")
a_thread = threading.Thread(target=__a_thread__)
print("1")
if __name__ == "__main__":
debugging() when invoked with $ python -m pdb multithreaded_debugging.py
> /mnt/DATA/richter/examples/python/multithreaded_debugging/multithreaded_debugging.py(3)<module>()
-> import threading
(Pdb) break 7
Breakpoint 1 at /mnt/DATA/richter/examples/python/multithreaded_debugging/multithreaded_debugging.py:7
(Pdb) c
1
The program finished and will be restarted
> /mnt/DATA/richter/examples/python/multithreaded_debugging/multithreaded_debugging.py(3)<module>()
-> import threading
(Pdb) |
Sorry, I mean
import threading
def debugging():
def __a_thread__():
print("2")
a_thread = threading.Thread(target=__a_thread__)
a_thread.start()
a_thread.join()
print("1")
if __name__ == "__main__":
debugging() It's very uncommon to set the current debugging thread in the source. |
Absolutely this. While it is good that there is at least some documentation (at sys.settrace), it is not very explicit nor is it self evident that one should look there (for example the PDB docs don't even mention settrace). |
See also https://bugs.python.org/issue41571 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: