|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.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><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.DebugClients.Python.ThreadExtension</h1> |
|
23 <p> |
|
24 Module implementing an import hook patching thread modules to get debugged too. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>_qtThreadNumber</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#QThreadWrapper">QThreadWrapper</a></td> |
|
34 <td>Wrapper class for *.QThread.</td> |
|
35 </tr><tr> |
|
36 <td><a href="#ThreadExtension">ThreadExtension</a></td> |
|
37 <td>Class implementing the thread support for the debugger.</td> |
|
38 </tr><tr> |
|
39 <td><a href="#ThreadWrapper">ThreadWrapper</a></td> |
|
40 <td>Wrapper class for threading.Thread.</td> |
|
41 </tr><tr> |
|
42 <td><a href="#TimerWrapper">TimerWrapper</a></td> |
|
43 <td>Wrapper class for threading.(_)Timer.</td> |
|
44 </tr> |
|
45 </table> |
|
46 <h3>Functions</h3> |
|
47 <table> |
|
48 <tr><td>None</td></tr> |
|
49 </table> |
|
50 <hr /><hr /> |
|
51 <a NAME="QThreadWrapper" ID="QThreadWrapper"></a> |
|
52 <h2>QThreadWrapper</h2> |
|
53 <p> |
|
54 Wrapper class for *.QThread. |
|
55 </p> |
|
56 <h3>Derived from</h3> |
|
57 module.QThread |
|
58 <h3>Class Attributes</h3> |
|
59 <table> |
|
60 <tr><td>None</td></tr> |
|
61 </table> |
|
62 <h3>Class Methods</h3> |
|
63 <table> |
|
64 <tr><td>None</td></tr> |
|
65 </table> |
|
66 <h3>Methods</h3> |
|
67 <table> |
|
68 <tr> |
|
69 <td><a href="#QThreadWrapper.__init__">QThreadWrapper</a></td> |
|
70 <td>Constructor</td> |
|
71 </tr> |
|
72 </table> |
|
73 <h3>Static Methods</h3> |
|
74 <table> |
|
75 <tr><td>None</td></tr> |
|
76 </table> |
|
77 <a NAME="QThreadWrapper.__init__" ID="QThreadWrapper.__init__"></a> |
|
78 <h4>QThreadWrapper (Constructor)</h4> |
|
79 <b>QThreadWrapper</b>(<i>*args, **kwargs</i>) |
|
80 <p> |
|
81 Constructor |
|
82 </p> |
|
83 <div align="right"><a href="#top">Up</a></div> |
|
84 <hr /><hr /> |
|
85 <a NAME="ThreadExtension" ID="ThreadExtension"></a> |
|
86 <h2>ThreadExtension</h2> |
|
87 <p> |
|
88 Class implementing the thread support for the debugger. |
|
89 </p><p> |
|
90 Provides methods for intercepting thread creation, retriving the running |
|
91 threads and their name and state. |
|
92 </p> |
|
93 <h3>Derived from</h3> |
|
94 object |
|
95 <h3>Class Attributes</h3> |
|
96 <table> |
|
97 <tr><td>None</td></tr> |
|
98 </table> |
|
99 <h3>Class Methods</h3> |
|
100 <table> |
|
101 <tr><td>None</td></tr> |
|
102 </table> |
|
103 <h3>Methods</h3> |
|
104 <table> |
|
105 <tr> |
|
106 <td><a href="#ThreadExtension.__init__">ThreadExtension</a></td> |
|
107 <td>Constructor</td> |
|
108 </tr><tr> |
|
109 <td><a href="#ThreadExtension._bootstrap">_bootstrap</a></td> |
|
110 <td>Bootstrap for threading, which reports exceptions correctly.</td> |
|
111 </tr><tr> |
|
112 <td><a href="#ThreadExtension._bootstrapQThread">_bootstrapQThread</a></td> |
|
113 <td>Bootstrap for QThread, which reports exceptions correctly.</td> |
|
114 </tr><tr> |
|
115 <td><a href="#ThreadExtension.attachThread">attachThread</a></td> |
|
116 <td>Public method to setup a standard thread for DebugClient to debug.</td> |
|
117 </tr><tr> |
|
118 <td><a href="#ThreadExtension.dumpThreadList">dumpThreadList</a></td> |
|
119 <td>Public method to send the list of threads.</td> |
|
120 </tr><tr> |
|
121 <td><a href="#ThreadExtension.find_module">find_module</a></td> |
|
122 <td>Public method returning the module loader.</td> |
|
123 </tr><tr> |
|
124 <td><a href="#ThreadExtension.getExecutedFrame">getExecutedFrame</a></td> |
|
125 <td>Public method to return the currently executed frame.</td> |
|
126 </tr><tr> |
|
127 <td><a href="#ThreadExtension.load_module">load_module</a></td> |
|
128 <td>Public method to load a module.</td> |
|
129 </tr><tr> |
|
130 <td><a href="#ThreadExtension.lockClient">lockClient</a></td> |
|
131 <td>Public method to acquire the lock for this client.</td> |
|
132 </tr><tr> |
|
133 <td><a href="#ThreadExtension.setCurrentThread">setCurrentThread</a></td> |
|
134 <td>Public method to set the current thread.</td> |
|
135 </tr><tr> |
|
136 <td><a href="#ThreadExtension.threadTerminated">threadTerminated</a></td> |
|
137 <td>Public method called when a DebugThread has exited.</td> |
|
138 </tr><tr> |
|
139 <td><a href="#ThreadExtension.unlockClient">unlockClient</a></td> |
|
140 <td>Public method to release the lock for this client.</td> |
|
141 </tr><tr> |
|
142 <td><a href="#ThreadExtension.updateThreadList">updateThreadList</a></td> |
|
143 <td>Public method to update the list of running threads.</td> |
|
144 </tr> |
|
145 </table> |
|
146 <h3>Static Methods</h3> |
|
147 <table> |
|
148 <tr><td>None</td></tr> |
|
149 </table> |
|
150 <a NAME="ThreadExtension.__init__" ID="ThreadExtension.__init__"></a> |
|
151 <h4>ThreadExtension (Constructor)</h4> |
|
152 <b>ThreadExtension</b>(<i></i>) |
|
153 <p> |
|
154 Constructor |
|
155 </p><a NAME="ThreadExtension._bootstrap" ID="ThreadExtension._bootstrap"></a> |
|
156 <h4>ThreadExtension._bootstrap</h4> |
|
157 <b>_bootstrap</b>(<i>run</i>) |
|
158 <p> |
|
159 Bootstrap for threading, which reports exceptions correctly. |
|
160 </p><dl> |
|
161 <dt><i>run</i> (method pointer)</dt> |
|
162 <dd> |
|
163 the run method of threading.Thread |
|
164 </dd> |
|
165 </dl><a NAME="ThreadExtension._bootstrapQThread" ID="ThreadExtension._bootstrapQThread"></a> |
|
166 <h4>ThreadExtension._bootstrapQThread</h4> |
|
167 <b>_bootstrapQThread</b>(<i>run</i>) |
|
168 <p> |
|
169 Bootstrap for QThread, which reports exceptions correctly. |
|
170 </p><dl> |
|
171 <dt><i>run</i> (method pointer)</dt> |
|
172 <dd> |
|
173 the run method of *.QThread |
|
174 </dd> |
|
175 </dl><a NAME="ThreadExtension.attachThread" ID="ThreadExtension.attachThread"></a> |
|
176 <h4>ThreadExtension.attachThread</h4> |
|
177 <b>attachThread</b>(<i>target=None, args=None, kwargs=None, mainThread=False</i>) |
|
178 <p> |
|
179 Public method to setup a standard thread for DebugClient to debug. |
|
180 </p><p> |
|
181 If mainThread is True, then we are attaching to the already |
|
182 started mainthread of the app and the rest of the args are ignored. |
|
183 </p><dl> |
|
184 <dt><i>target</i></dt> |
|
185 <dd> |
|
186 the start function of the target thread (i.e. the user |
|
187 code) |
|
188 </dd><dt><i>args</i></dt> |
|
189 <dd> |
|
190 arguments to pass to target |
|
191 </dd><dt><i>kwargs</i></dt> |
|
192 <dd> |
|
193 keyword arguments to pass to target |
|
194 </dd><dt><i>mainThread</i></dt> |
|
195 <dd> |
|
196 True, if we are attaching to the already |
|
197 started mainthread of the app |
|
198 </dd> |
|
199 </dl><dl> |
|
200 <dt>Returns:</dt> |
|
201 <dd> |
|
202 identifier of the created thread |
|
203 </dd> |
|
204 </dl><a NAME="ThreadExtension.dumpThreadList" ID="ThreadExtension.dumpThreadList"></a> |
|
205 <h4>ThreadExtension.dumpThreadList</h4> |
|
206 <b>dumpThreadList</b>(<i></i>) |
|
207 <p> |
|
208 Public method to send the list of threads. |
|
209 </p><a NAME="ThreadExtension.find_module" ID="ThreadExtension.find_module"></a> |
|
210 <h4>ThreadExtension.find_module</h4> |
|
211 <b>find_module</b>(<i>fullname, path=None</i>) |
|
212 <p> |
|
213 Public method returning the module loader. |
|
214 </p><dl> |
|
215 <dt><i>fullname</i> (str)</dt> |
|
216 <dd> |
|
217 name of the module to be loaded |
|
218 </dd><dt><i>path</i> (str)</dt> |
|
219 <dd> |
|
220 path to resolve the module name |
|
221 </dd> |
|
222 </dl><dl> |
|
223 <dt>Returns:</dt> |
|
224 <dd> |
|
225 module loader object |
|
226 </dd> |
|
227 </dl><dl> |
|
228 <dt>Return Type:</dt> |
|
229 <dd> |
|
230 object |
|
231 </dd> |
|
232 </dl><a NAME="ThreadExtension.getExecutedFrame" ID="ThreadExtension.getExecutedFrame"></a> |
|
233 <h4>ThreadExtension.getExecutedFrame</h4> |
|
234 <b>getExecutedFrame</b>(<i>frame</i>) |
|
235 <p> |
|
236 Public method to return the currently executed frame. |
|
237 </p><dl> |
|
238 <dt><i>frame</i> (frame object)</dt> |
|
239 <dd> |
|
240 the current frame |
|
241 </dd> |
|
242 </dl><dl> |
|
243 <dt>Returns:</dt> |
|
244 <dd> |
|
245 the frame which is excecuted (without debugger frames) |
|
246 </dd> |
|
247 </dl><dl> |
|
248 <dt>Return Type:</dt> |
|
249 <dd> |
|
250 frame object |
|
251 </dd> |
|
252 </dl><a NAME="ThreadExtension.load_module" ID="ThreadExtension.load_module"></a> |
|
253 <h4>ThreadExtension.load_module</h4> |
|
254 <b>load_module</b>(<i>fullname</i>) |
|
255 <p> |
|
256 Public method to load a module. |
|
257 </p><dl> |
|
258 <dt><i>fullname</i> (str)</dt> |
|
259 <dd> |
|
260 name of the module to be loaded |
|
261 </dd> |
|
262 </dl><dl> |
|
263 <dt>Returns:</dt> |
|
264 <dd> |
|
265 reference to the loaded module |
|
266 </dd> |
|
267 </dl><dl> |
|
268 <dt>Return Type:</dt> |
|
269 <dd> |
|
270 module |
|
271 </dd> |
|
272 </dl><a NAME="ThreadExtension.lockClient" ID="ThreadExtension.lockClient"></a> |
|
273 <h4>ThreadExtension.lockClient</h4> |
|
274 <b>lockClient</b>(<i>blocking=True</i>) |
|
275 <p> |
|
276 Public method to acquire the lock for this client. |
|
277 </p><dl> |
|
278 <dt><i>blocking</i> (bool)</dt> |
|
279 <dd> |
|
280 flag to indicating a blocking lock |
|
281 </dd> |
|
282 </dl><dl> |
|
283 <dt>Returns:</dt> |
|
284 <dd> |
|
285 flag indicating successful locking |
|
286 </dd> |
|
287 </dl><dl> |
|
288 <dt>Return Type:</dt> |
|
289 <dd> |
|
290 bool |
|
291 </dd> |
|
292 </dl><a NAME="ThreadExtension.setCurrentThread" ID="ThreadExtension.setCurrentThread"></a> |
|
293 <h4>ThreadExtension.setCurrentThread</h4> |
|
294 <b>setCurrentThread</b>(<i>threadId</i>) |
|
295 <p> |
|
296 Public method to set the current thread. |
|
297 </p><dl> |
|
298 <dt><i>threadId</i> (int)</dt> |
|
299 <dd> |
|
300 the id the current thread should be set to. |
|
301 </dd> |
|
302 </dl><a NAME="ThreadExtension.threadTerminated" ID="ThreadExtension.threadTerminated"></a> |
|
303 <h4>ThreadExtension.threadTerminated</h4> |
|
304 <b>threadTerminated</b>(<i>threadId</i>) |
|
305 <p> |
|
306 Public method called when a DebugThread has exited. |
|
307 </p><dl> |
|
308 <dt><i>threadId</i> (int)</dt> |
|
309 <dd> |
|
310 id of the DebugThread that has exited |
|
311 </dd> |
|
312 </dl><a NAME="ThreadExtension.unlockClient" ID="ThreadExtension.unlockClient"></a> |
|
313 <h4>ThreadExtension.unlockClient</h4> |
|
314 <b>unlockClient</b>(<i></i>) |
|
315 <p> |
|
316 Public method to release the lock for this client. |
|
317 </p><a NAME="ThreadExtension.updateThreadList" ID="ThreadExtension.updateThreadList"></a> |
|
318 <h4>ThreadExtension.updateThreadList</h4> |
|
319 <b>updateThreadList</b>(<i></i>) |
|
320 <p> |
|
321 Public method to update the list of running threads. |
|
322 </p> |
|
323 <div align="right"><a href="#top">Up</a></div> |
|
324 <hr /><hr /> |
|
325 <a NAME="ThreadWrapper" ID="ThreadWrapper"></a> |
|
326 <h2>ThreadWrapper</h2> |
|
327 <p> |
|
328 Wrapper class for threading.Thread. |
|
329 </p> |
|
330 <h3>Derived from</h3> |
|
331 module.Thread |
|
332 <h3>Class Attributes</h3> |
|
333 <table> |
|
334 <tr><td>timer</td></tr> |
|
335 </table> |
|
336 <h3>Class Methods</h3> |
|
337 <table> |
|
338 <tr><td>None</td></tr> |
|
339 </table> |
|
340 <h3>Methods</h3> |
|
341 <table> |
|
342 <tr> |
|
343 <td><a href="#ThreadWrapper.__init__">ThreadWrapper</a></td> |
|
344 <td>Constructor</td> |
|
345 </tr> |
|
346 </table> |
|
347 <h3>Static Methods</h3> |
|
348 <table> |
|
349 <tr><td>None</td></tr> |
|
350 </table> |
|
351 <a NAME="ThreadWrapper.__init__" ID="ThreadWrapper.__init__"></a> |
|
352 <h4>ThreadWrapper (Constructor)</h4> |
|
353 <b>ThreadWrapper</b>(<i>*args, **kwargs</i>) |
|
354 <p> |
|
355 Constructor |
|
356 </p> |
|
357 <div align="right"><a href="#top">Up</a></div> |
|
358 <hr /><hr /> |
|
359 <a NAME="TimerWrapper" ID="TimerWrapper"></a> |
|
360 <h2>TimerWrapper</h2> |
|
361 <p> |
|
362 Wrapper class for threading.(_)Timer. |
|
363 </p> |
|
364 <h3>Derived from</h3> |
|
365 timer, ThreadWrapper |
|
366 <h3>Class Attributes</h3> |
|
367 <table> |
|
368 <tr><td>None</td></tr> |
|
369 </table> |
|
370 <h3>Class Methods</h3> |
|
371 <table> |
|
372 <tr><td>None</td></tr> |
|
373 </table> |
|
374 <h3>Methods</h3> |
|
375 <table> |
|
376 <tr> |
|
377 <td><a href="#TimerWrapper.__init__">TimerWrapper</a></td> |
|
378 <td>Constructor</td> |
|
379 </tr> |
|
380 </table> |
|
381 <h3>Static Methods</h3> |
|
382 <table> |
|
383 <tr><td>None</td></tr> |
|
384 </table> |
|
385 <a NAME="TimerWrapper.__init__" ID="TimerWrapper.__init__"></a> |
|
386 <h4>TimerWrapper (Constructor)</h4> |
|
387 <b>TimerWrapper</b>(<i>interval, function, *args, **kwargs</i>) |
|
388 <p> |
|
389 Constructor |
|
390 </p> |
|
391 <div align="right"><a href="#top">Up</a></div> |
|
392 <hr /> |
|
393 </body></html> |