Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>See <a href="http://heather.cs.ucdavis.edu/~matloff/158/PLN/ParProcBook.pdf" rel="nofollow">http://heather.cs.ucdavis.edu/~matloff/158/PLN/ParProcBook.pdf</a>, there's a section on multithreaded debugging.</p> <pre> 3.6.1 Using PDB to Debug Threaded Programs Using PDB is a bit more complex when threads are involved. One cannot, for instance, simply do something like this: pdb.py buggyprog.py because the child threads will not inherit the PDB process from the main thread. You can still run PDB in the latter, but will not be able to set breakpoints in threads. What you can do, though, is invoke PDB from within the function which is run by the thread, by calling pdb.set trace() at one or more points within the code: import pdb pdb.set_trace() In essence, those become breakpoints. For example, in our program srvr.py in Section 3.1.1, we could add a PDB call at the beginning of the loop in serveclient(): while 1: import pdb pdb.set_trace() # receive letter from client, if it is still connected k = c.recv(1) if k == ’’: break You then run the program directly through the Python interpreter as usual, NOT through PDB, but then the program suddenly moves into debugging mode on its own. At that point, one can then step through the code using the n or s commands, query the values of variables, etc. PDB’s c (“continue”) command still works. Can one still use the b command to set additional breakpoints? Yes, but it might be only on a one-time basis, depending on the context. A breakpoint might work only once, due to a scope problem. Leaving the scope where we invoked PDB causes removal of the trace object. Thus I suggested setting up the trace inside the loop above. </pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload