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