Bharel
Bharel

Reputation: 26901

PDB doesn't stop on breakpoint in multithreaded code

I'm using multi-threaded code and PDB doesn't stop on manually set breakpoints:

(pdb) b filename:lineno
(pdb) c  # Runs without stopping

What could be the reason why?

Upvotes: 5

Views: 3906

Answers (2)

Jürgen Gmach
Jürgen Gmach

Reputation: 6123

Instead of pdb use e.g. web-pdb.

https://pypi.org/project/web-pdb/

Upvotes: -1

Bharel
Bharel

Reputation: 26901

As of September 2020, Python's pdb debugger does not support multi-threading.

Attempting to break on a different thread from where pdb started, will skip the breakpoints. This is due to the current implementation using sys.settrace() which is thread-specific.

There's a ticket for implementing this functionality among other multi-threading additions.

Currently, the only option is to pdb.set_trace() on the same thread being debugged.

Upvotes: 12

Related Questions