|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.DebugClients.Python.ThreadExtension</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.DebugClients.Python.ThreadExtension</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing an import hook patching thread modules to get debugged too. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>_qtThreadNumber</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#DummyThreadWrapper">DummyThreadWrapper</a></td> |
|
25 <td>Wrapper class for threading._DummyThread.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#QRunnableWrapper">QRunnableWrapper</a></td> |
|
29 <td>Wrapper class for *.QRunnable.</td> |
|
30 </tr> |
|
31 <tr> |
|
32 <td><a href="#QThreadWrapper">QThreadWrapper</a></td> |
|
33 <td>Wrapper class for *.QThread.</td> |
|
34 </tr> |
|
35 <tr> |
|
36 <td><a href="#ThreadExtension">ThreadExtension</a></td> |
|
37 <td>Class implementing the thread support for the debugger.</td> |
|
38 </tr> |
|
39 <tr> |
|
40 <td><a href="#ThreadWrapper">ThreadWrapper</a></td> |
|
41 <td>Wrapper class for threading.Thread.</td> |
|
42 </tr> |
|
43 <tr> |
|
44 <td><a href="#TimerWrapper">TimerWrapper</a></td> |
|
45 <td>Wrapper class for threading.(_)Timer.</td> |
|
46 </tr> |
|
47 </table> |
|
48 <h3>Functions</h3> |
|
49 |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <hr /> |
|
54 <hr /> |
|
55 <a NAME="DummyThreadWrapper" ID="DummyThreadWrapper"></a> |
|
56 <h2>DummyThreadWrapper</h2> |
|
57 |
|
58 <p> |
|
59 Wrapper class for threading._DummyThread. |
|
60 </p> |
|
61 <h3>Derived from</h3> |
|
62 module._DummyThread, ThreadWrapper |
|
63 <h3>Class Attributes</h3> |
|
64 |
|
65 <table> |
|
66 <tr><td>None</td></tr> |
|
67 </table> |
|
68 <h3>Class Methods</h3> |
|
69 |
|
70 <table> |
|
71 <tr><td>None</td></tr> |
|
72 </table> |
|
73 <h3>Methods</h3> |
|
74 |
|
75 <table> |
|
76 |
|
77 <tr> |
|
78 <td><a href="#DummyThreadWrapper.__init__">DummyThreadWrapper</a></td> |
|
79 <td>Constructor</td> |
|
80 </tr> |
|
81 </table> |
|
82 <h3>Static Methods</h3> |
|
83 |
|
84 <table> |
|
85 <tr><td>None</td></tr> |
|
86 </table> |
|
87 |
|
88 <a NAME="DummyThreadWrapper.__init__" ID="DummyThreadWrapper.__init__"></a> |
|
89 <h4>DummyThreadWrapper (Constructor)</h4> |
|
90 <b>DummyThreadWrapper</b>(<i>*args, **kwargs</i>) |
|
91 |
|
92 <p> |
|
93 Constructor |
|
94 </p> |
|
95 <div align="right"><a href="#top">Up</a></div> |
|
96 <hr /> |
|
97 <hr /> |
|
98 <a NAME="QRunnableWrapper" ID="QRunnableWrapper"></a> |
|
99 <h2>QRunnableWrapper</h2> |
|
100 |
|
101 <p> |
|
102 Wrapper class for *.QRunnable. |
|
103 </p> |
|
104 <h3>Derived from</h3> |
|
105 module.QRunnable |
|
106 <h3>Class Attributes</h3> |
|
107 |
|
108 <table> |
|
109 <tr><td>None</td></tr> |
|
110 </table> |
|
111 <h3>Class Methods</h3> |
|
112 |
|
113 <table> |
|
114 <tr><td>None</td></tr> |
|
115 </table> |
|
116 <h3>Methods</h3> |
|
117 |
|
118 <table> |
|
119 |
|
120 <tr> |
|
121 <td><a href="#QRunnableWrapper.__init__">QRunnableWrapper</a></td> |
|
122 <td>Constructor</td> |
|
123 </tr> |
|
124 </table> |
|
125 <h3>Static Methods</h3> |
|
126 |
|
127 <table> |
|
128 <tr><td>None</td></tr> |
|
129 </table> |
|
130 |
|
131 <a NAME="QRunnableWrapper.__init__" ID="QRunnableWrapper.__init__"></a> |
|
132 <h4>QRunnableWrapper (Constructor)</h4> |
|
133 <b>QRunnableWrapper</b>(<i>*args, **kwargs</i>) |
|
134 |
|
135 <p> |
|
136 Constructor |
|
137 </p> |
|
138 <div align="right"><a href="#top">Up</a></div> |
|
139 <hr /> |
|
140 <hr /> |
|
141 <a NAME="QThreadWrapper" ID="QThreadWrapper"></a> |
|
142 <h2>QThreadWrapper</h2> |
|
143 |
|
144 <p> |
|
145 Wrapper class for *.QThread. |
|
146 </p> |
|
147 <h3>Derived from</h3> |
|
148 module.QThread |
|
149 <h3>Class Attributes</h3> |
|
150 |
|
151 <table> |
|
152 <tr><td>None</td></tr> |
|
153 </table> |
|
154 <h3>Class Methods</h3> |
|
155 |
|
156 <table> |
|
157 <tr><td>None</td></tr> |
|
158 </table> |
|
159 <h3>Methods</h3> |
|
160 |
|
161 <table> |
|
162 |
|
163 <tr> |
|
164 <td><a href="#QThreadWrapper.__init__">QThreadWrapper</a></td> |
|
165 <td>Constructor</td> |
|
166 </tr> |
|
167 </table> |
|
168 <h3>Static Methods</h3> |
|
169 |
|
170 <table> |
|
171 <tr><td>None</td></tr> |
|
172 </table> |
|
173 |
|
174 <a NAME="QThreadWrapper.__init__" ID="QThreadWrapper.__init__"></a> |
|
175 <h4>QThreadWrapper (Constructor)</h4> |
|
176 <b>QThreadWrapper</b>(<i>*args, **kwargs</i>) |
|
177 |
|
178 <p> |
|
179 Constructor |
|
180 </p> |
|
181 <div align="right"><a href="#top">Up</a></div> |
|
182 <hr /> |
|
183 <hr /> |
|
184 <a NAME="ThreadExtension" ID="ThreadExtension"></a> |
|
185 <h2>ThreadExtension</h2> |
|
186 |
|
187 <p> |
|
188 Class implementing the thread support for the debugger. |
|
189 </p> |
|
190 <p> |
|
191 Provides methods for intercepting thread creation, retrieving the running |
|
192 threads and their name and state. |
|
193 </p> |
|
194 <h3>Derived from</h3> |
|
195 None |
|
196 <h3>Class Attributes</h3> |
|
197 |
|
198 <table> |
|
199 <tr><td>None</td></tr> |
|
200 </table> |
|
201 <h3>Class Methods</h3> |
|
202 |
|
203 <table> |
|
204 <tr><td>None</td></tr> |
|
205 </table> |
|
206 <h3>Methods</h3> |
|
207 |
|
208 <table> |
|
209 |
|
210 <tr> |
|
211 <td><a href="#ThreadExtension.__init__">ThreadExtension</a></td> |
|
212 <td>Constructor</td> |
|
213 </tr> |
|
214 <tr> |
|
215 <td><a href="#ThreadExtension._bootstrap">_bootstrap</a></td> |
|
216 <td>Bootstrap for threading, which reports exceptions correctly.</td> |
|
217 </tr> |
|
218 <tr> |
|
219 <td><a href="#ThreadExtension._bootstrapQThread">_bootstrapQThread</a></td> |
|
220 <td>Bootstrap for QThread, which reports exceptions correctly.</td> |
|
221 </tr> |
|
222 <tr> |
|
223 <td><a href="#ThreadExtension.attachThread">attachThread</a></td> |
|
224 <td>Public method to setup a standard thread for DebugClient to debug.</td> |
|
225 </tr> |
|
226 <tr> |
|
227 <td><a href="#ThreadExtension.dumpThreadList">dumpThreadList</a></td> |
|
228 <td>Public method to send the list of threads.</td> |
|
229 </tr> |
|
230 <tr> |
|
231 <td><a href="#ThreadExtension.getExecutedFrame">getExecutedFrame</a></td> |
|
232 <td>Public method to return the currently executed frame.</td> |
|
233 </tr> |
|
234 <tr> |
|
235 <td><a href="#ThreadExtension.lockClient">lockClient</a></td> |
|
236 <td>Public method to acquire the lock for this client.</td> |
|
237 </tr> |
|
238 <tr> |
|
239 <td><a href="#ThreadExtension.patchGreenlet">patchGreenlet</a></td> |
|
240 <td>Public method to patch the 'greenlet' module.</td> |
|
241 </tr> |
|
242 <tr> |
|
243 <td><a href="#ThreadExtension.patchPyThread">patchPyThread</a></td> |
|
244 <td>Public method to patch Python _thread module.</td> |
|
245 </tr> |
|
246 <tr> |
|
247 <td><a href="#ThreadExtension.patchPyThreading">patchPyThreading</a></td> |
|
248 <td>Public method to patch the Python threading module.</td> |
|
249 </tr> |
|
250 <tr> |
|
251 <td><a href="#ThreadExtension.patchQThread">patchQThread</a></td> |
|
252 <td>Public method to patch the QtCore module's QThread.</td> |
|
253 </tr> |
|
254 <tr> |
|
255 <td><a href="#ThreadExtension.setCurrentThread">setCurrentThread</a></td> |
|
256 <td>Public method to set the current thread.</td> |
|
257 </tr> |
|
258 <tr> |
|
259 <td><a href="#ThreadExtension.threadTerminated">threadTerminated</a></td> |
|
260 <td>Public method called when a DebugThread has exited.</td> |
|
261 </tr> |
|
262 <tr> |
|
263 <td><a href="#ThreadExtension.unlockClient">unlockClient</a></td> |
|
264 <td>Public method to release the lock for this client.</td> |
|
265 </tr> |
|
266 <tr> |
|
267 <td><a href="#ThreadExtension.updateThreadList">updateThreadList</a></td> |
|
268 <td>Public method to update the list of running threads.</td> |
|
269 </tr> |
|
270 </table> |
|
271 <h3>Static Methods</h3> |
|
272 |
|
273 <table> |
|
274 <tr><td>None</td></tr> |
|
275 </table> |
|
276 |
|
277 <a NAME="ThreadExtension.__init__" ID="ThreadExtension.__init__"></a> |
|
278 <h4>ThreadExtension (Constructor)</h4> |
|
279 <b>ThreadExtension</b>(<i></i>) |
|
280 |
|
281 <p> |
|
282 Constructor |
|
283 </p> |
|
284 <a NAME="ThreadExtension._bootstrap" ID="ThreadExtension._bootstrap"></a> |
|
285 <h4>ThreadExtension._bootstrap</h4> |
|
286 <b>_bootstrap</b>(<i>run</i>) |
|
287 |
|
288 <p> |
|
289 Bootstrap for threading, which reports exceptions correctly. |
|
290 </p> |
|
291 <dl> |
|
292 |
|
293 <dt><i>run</i> (method pointer)</dt> |
|
294 <dd> |
|
295 the run method of threading.Thread |
|
296 </dd> |
|
297 </dl> |
|
298 <a NAME="ThreadExtension._bootstrapQThread" ID="ThreadExtension._bootstrapQThread"></a> |
|
299 <h4>ThreadExtension._bootstrapQThread</h4> |
|
300 <b>_bootstrapQThread</b>(<i>run</i>) |
|
301 |
|
302 <p> |
|
303 Bootstrap for QThread, which reports exceptions correctly. |
|
304 </p> |
|
305 <dl> |
|
306 |
|
307 <dt><i>run</i> (method pointer)</dt> |
|
308 <dd> |
|
309 the run method of *.QThread |
|
310 </dd> |
|
311 </dl> |
|
312 <a NAME="ThreadExtension.attachThread" ID="ThreadExtension.attachThread"></a> |
|
313 <h4>ThreadExtension.attachThread</h4> |
|
314 <b>attachThread</b>(<i>target=None, args=None, kwargs=None, mainThread=False</i>) |
|
315 |
|
316 <p> |
|
317 Public method to setup a standard thread for DebugClient to debug. |
|
318 </p> |
|
319 <p> |
|
320 If mainThread is True, then we are attaching to the already |
|
321 started mainthread of the app and the rest of the args are ignored. |
|
322 </p> |
|
323 <dl> |
|
324 |
|
325 <dt><i>target</i></dt> |
|
326 <dd> |
|
327 the start function of the target thread (i.e. the user |
|
328 code) |
|
329 </dd> |
|
330 <dt><i>args</i></dt> |
|
331 <dd> |
|
332 arguments to pass to target |
|
333 </dd> |
|
334 <dt><i>kwargs</i></dt> |
|
335 <dd> |
|
336 keyword arguments to pass to target |
|
337 </dd> |
|
338 <dt><i>mainThread</i></dt> |
|
339 <dd> |
|
340 True, if we are attaching to the already |
|
341 started mainthread of the app |
|
342 </dd> |
|
343 </dl> |
|
344 <dl> |
|
345 <dt>Return:</dt> |
|
346 <dd> |
|
347 identifier of the created thread |
|
348 </dd> |
|
349 </dl> |
|
350 <a NAME="ThreadExtension.dumpThreadList" ID="ThreadExtension.dumpThreadList"></a> |
|
351 <h4>ThreadExtension.dumpThreadList</h4> |
|
352 <b>dumpThreadList</b>(<i></i>) |
|
353 |
|
354 <p> |
|
355 Public method to send the list of threads. |
|
356 </p> |
|
357 <a NAME="ThreadExtension.getExecutedFrame" ID="ThreadExtension.getExecutedFrame"></a> |
|
358 <h4>ThreadExtension.getExecutedFrame</h4> |
|
359 <b>getExecutedFrame</b>(<i>frame</i>) |
|
360 |
|
361 <p> |
|
362 Public method to return the currently executed frame. |
|
363 </p> |
|
364 <dl> |
|
365 |
|
366 <dt><i>frame</i> (frame object)</dt> |
|
367 <dd> |
|
368 the current frame |
|
369 </dd> |
|
370 </dl> |
|
371 <dl> |
|
372 <dt>Return:</dt> |
|
373 <dd> |
|
374 the frame which is excecuted (without debugger frames) |
|
375 </dd> |
|
376 </dl> |
|
377 <dl> |
|
378 <dt>Return Type:</dt> |
|
379 <dd> |
|
380 frame object |
|
381 </dd> |
|
382 </dl> |
|
383 <a NAME="ThreadExtension.lockClient" ID="ThreadExtension.lockClient"></a> |
|
384 <h4>ThreadExtension.lockClient</h4> |
|
385 <b>lockClient</b>(<i>blocking=True</i>) |
|
386 |
|
387 <p> |
|
388 Public method to acquire the lock for this client. |
|
389 </p> |
|
390 <dl> |
|
391 |
|
392 <dt><i>blocking</i> (bool)</dt> |
|
393 <dd> |
|
394 flag to indicating a blocking lock |
|
395 </dd> |
|
396 </dl> |
|
397 <dl> |
|
398 <dt>Return:</dt> |
|
399 <dd> |
|
400 flag indicating successful locking |
|
401 </dd> |
|
402 </dl> |
|
403 <dl> |
|
404 <dt>Return Type:</dt> |
|
405 <dd> |
|
406 bool |
|
407 </dd> |
|
408 </dl> |
|
409 <a NAME="ThreadExtension.patchGreenlet" ID="ThreadExtension.patchGreenlet"></a> |
|
410 <h4>ThreadExtension.patchGreenlet</h4> |
|
411 <b>patchGreenlet</b>(<i>module</i>) |
|
412 |
|
413 <p> |
|
414 Public method to patch the 'greenlet' module. |
|
415 </p> |
|
416 <dl> |
|
417 |
|
418 <dt><i>module</i> (module)</dt> |
|
419 <dd> |
|
420 reference to the imported module to be patched |
|
421 </dd> |
|
422 </dl> |
|
423 <dl> |
|
424 <dt>Return:</dt> |
|
425 <dd> |
|
426 flag indicating that the module was processed |
|
427 </dd> |
|
428 </dl> |
|
429 <dl> |
|
430 <dt>Return Type:</dt> |
|
431 <dd> |
|
432 bool |
|
433 </dd> |
|
434 </dl> |
|
435 <a NAME="ThreadExtension.patchPyThread" ID="ThreadExtension.patchPyThread"></a> |
|
436 <h4>ThreadExtension.patchPyThread</h4> |
|
437 <b>patchPyThread</b>(<i>module</i>) |
|
438 |
|
439 <p> |
|
440 Public method to patch Python _thread module. |
|
441 </p> |
|
442 <dl> |
|
443 |
|
444 <dt><i>module</i> (module)</dt> |
|
445 <dd> |
|
446 reference to the imported module to be patched |
|
447 </dd> |
|
448 </dl> |
|
449 <a NAME="ThreadExtension.patchPyThreading" ID="ThreadExtension.patchPyThreading"></a> |
|
450 <h4>ThreadExtension.patchPyThreading</h4> |
|
451 <b>patchPyThreading</b>(<i>module</i>) |
|
452 |
|
453 <p> |
|
454 Public method to patch the Python threading module. |
|
455 </p> |
|
456 <dl> |
|
457 |
|
458 <dt><i>module</i> (module)</dt> |
|
459 <dd> |
|
460 reference to the imported module to be patched |
|
461 </dd> |
|
462 </dl> |
|
463 <a NAME="ThreadExtension.patchQThread" ID="ThreadExtension.patchQThread"></a> |
|
464 <h4>ThreadExtension.patchQThread</h4> |
|
465 <b>patchQThread</b>(<i>module</i>) |
|
466 |
|
467 <p> |
|
468 Public method to patch the QtCore module's QThread. |
|
469 </p> |
|
470 <dl> |
|
471 |
|
472 <dt><i>module</i> (module)</dt> |
|
473 <dd> |
|
474 reference to the imported module to be patched |
|
475 </dd> |
|
476 </dl> |
|
477 <a NAME="ThreadExtension.setCurrentThread" ID="ThreadExtension.setCurrentThread"></a> |
|
478 <h4>ThreadExtension.setCurrentThread</h4> |
|
479 <b>setCurrentThread</b>(<i>threadId</i>) |
|
480 |
|
481 <p> |
|
482 Public method to set the current thread. |
|
483 </p> |
|
484 <dl> |
|
485 |
|
486 <dt><i>threadId</i> (int)</dt> |
|
487 <dd> |
|
488 the id the current thread should be set to. |
|
489 </dd> |
|
490 </dl> |
|
491 <a NAME="ThreadExtension.threadTerminated" ID="ThreadExtension.threadTerminated"></a> |
|
492 <h4>ThreadExtension.threadTerminated</h4> |
|
493 <b>threadTerminated</b>(<i>threadId</i>) |
|
494 |
|
495 <p> |
|
496 Public method called when a DebugThread has exited. |
|
497 </p> |
|
498 <dl> |
|
499 |
|
500 <dt><i>threadId</i> (int)</dt> |
|
501 <dd> |
|
502 id of the DebugThread that has exited |
|
503 </dd> |
|
504 </dl> |
|
505 <a NAME="ThreadExtension.unlockClient" ID="ThreadExtension.unlockClient"></a> |
|
506 <h4>ThreadExtension.unlockClient</h4> |
|
507 <b>unlockClient</b>(<i></i>) |
|
508 |
|
509 <p> |
|
510 Public method to release the lock for this client. |
|
511 </p> |
|
512 <a NAME="ThreadExtension.updateThreadList" ID="ThreadExtension.updateThreadList"></a> |
|
513 <h4>ThreadExtension.updateThreadList</h4> |
|
514 <b>updateThreadList</b>(<i></i>) |
|
515 |
|
516 <p> |
|
517 Public method to update the list of running threads. |
|
518 </p> |
|
519 <div align="right"><a href="#top">Up</a></div> |
|
520 <hr /> |
|
521 <hr /> |
|
522 <a NAME="ThreadWrapper" ID="ThreadWrapper"></a> |
|
523 <h2>ThreadWrapper</h2> |
|
524 |
|
525 <p> |
|
526 Wrapper class for threading.Thread. |
|
527 </p> |
|
528 <h3>Derived from</h3> |
|
529 module.Thread |
|
530 <h3>Class Attributes</h3> |
|
531 |
|
532 <table> |
|
533 <tr><td>None</td></tr> |
|
534 </table> |
|
535 <h3>Class Methods</h3> |
|
536 |
|
537 <table> |
|
538 <tr><td>None</td></tr> |
|
539 </table> |
|
540 <h3>Methods</h3> |
|
541 |
|
542 <table> |
|
543 |
|
544 <tr> |
|
545 <td><a href="#ThreadWrapper.__init__">ThreadWrapper</a></td> |
|
546 <td>Constructor</td> |
|
547 </tr> |
|
548 </table> |
|
549 <h3>Static Methods</h3> |
|
550 |
|
551 <table> |
|
552 <tr><td>None</td></tr> |
|
553 </table> |
|
554 |
|
555 <a NAME="ThreadWrapper.__init__" ID="ThreadWrapper.__init__"></a> |
|
556 <h4>ThreadWrapper (Constructor)</h4> |
|
557 <b>ThreadWrapper</b>(<i>*args, **kwargs</i>) |
|
558 |
|
559 <p> |
|
560 Constructor |
|
561 </p> |
|
562 <div align="right"><a href="#top">Up</a></div> |
|
563 <hr /> |
|
564 <hr /> |
|
565 <a NAME="TimerWrapper" ID="TimerWrapper"></a> |
|
566 <h2>TimerWrapper</h2> |
|
567 |
|
568 <p> |
|
569 Wrapper class for threading.(_)Timer. |
|
570 </p> |
|
571 <h3>Derived from</h3> |
|
572 timer, ThreadWrapper |
|
573 <h3>Class Attributes</h3> |
|
574 |
|
575 <table> |
|
576 <tr><td>None</td></tr> |
|
577 </table> |
|
578 <h3>Class Methods</h3> |
|
579 |
|
580 <table> |
|
581 <tr><td>None</td></tr> |
|
582 </table> |
|
583 <h3>Methods</h3> |
|
584 |
|
585 <table> |
|
586 |
|
587 <tr> |
|
588 <td><a href="#TimerWrapper.__init__">TimerWrapper</a></td> |
|
589 <td>Constructor</td> |
|
590 </tr> |
|
591 </table> |
|
592 <h3>Static Methods</h3> |
|
593 |
|
594 <table> |
|
595 <tr><td>None</td></tr> |
|
596 </table> |
|
597 |
|
598 <a NAME="TimerWrapper.__init__" ID="TimerWrapper.__init__"></a> |
|
599 <h4>TimerWrapper (Constructor)</h4> |
|
600 <b>TimerWrapper</b>(<i>interval, function, *args, **kwargs</i>) |
|
601 |
|
602 <p> |
|
603 Constructor |
|
604 </p> |
|
605 <div align="right"><a href="#top">Up</a></div> |
|
606 <hr /> |
|
607 </body></html> |