1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.DebugClients.Python.DebugClientBase</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.DebugClientBase</h1> |
|
23 <p> |
|
24 Module implementing a debug client base class. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>DebugClientInstance</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#DebugClientBase">DebugClientBase</a></td> |
|
34 <td>Class implementing the client side of the debugger.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr> |
|
40 <td><a href="#DebugClientClose">DebugClientClose</a></td> |
|
41 <td>Replacement for the standard os.close(fd).</td> |
|
42 </tr><tr> |
|
43 <td><a href="#DebugClientFork">DebugClientFork</a></td> |
|
44 <td>Replacement for the standard os.fork().</td> |
|
45 </tr><tr> |
|
46 <td><a href="#DebugClientInput">DebugClientInput</a></td> |
|
47 <td>Replacement for the standard input builtin.</td> |
|
48 </tr><tr> |
|
49 <td><a href="#DebugClientRawInput">DebugClientRawInput</a></td> |
|
50 <td>Replacement for the standard raw_input builtin.</td> |
|
51 </tr><tr> |
|
52 <td><a href="#DebugClientSetRecursionLimit">DebugClientSetRecursionLimit</a></td> |
|
53 <td>Replacement for the standard sys.setrecursionlimit(limit).</td> |
|
54 </tr> |
|
55 </table> |
|
56 <hr /><hr /> |
|
57 <a NAME="DebugClientBase" ID="DebugClientBase"></a> |
|
58 <h2>DebugClientBase</h2> |
|
59 <p> |
|
60 Class implementing the client side of the debugger. |
|
61 </p><p> |
|
62 It provides access to the Python interpeter from a debugger running in |
|
63 another process whether or not the Qt event loop is running. |
|
64 </p><p> |
|
65 The protocol between the debugger and the client assumes that there will be |
|
66 a single source of debugger commands and a single source of Python |
|
67 statements. Commands and statement are always exactly one line and may be |
|
68 interspersed. |
|
69 </p><p> |
|
70 The protocol is as follows. First the client opens a connection to the |
|
71 debugger and then sends a series of one line commands. A command is either |
|
72 >Load<, >Step<, >StepInto<, ... or a Python statement. |
|
73 See DebugProtocol.py for a listing of valid protocol tokens. |
|
74 </p><p> |
|
75 A Python statement consists of the statement to execute, followed (in a |
|
76 separate line) by >OK?<. If the statement was incomplete then the |
|
77 response is >Continue<. If there was an exception then the response |
|
78 is >Exception<. Otherwise the response is >OK<. The reason |
|
79 for the >OK?< part is to provide a sentinal (ie. the responding |
|
80 >OK<) after any possible output as a result of executing the command. |
|
81 </p><p> |
|
82 The client may send any other lines at any other time which should be |
|
83 interpreted as program output. |
|
84 </p><p> |
|
85 If the debugger closes the session there is no response from the client. |
|
86 The client may close the session at any time as a result of the script |
|
87 being debugged closing or crashing. |
|
88 </p><p> |
|
89 <b>Note</b>: This class is meant to be subclassed by individual |
|
90 DebugClient classes. Do not instantiate it directly. |
|
91 </p> |
|
92 <h3>Derived from</h3> |
|
93 object |
|
94 <h3>Class Attributes</h3> |
|
95 <table> |
|
96 <tr><td>clientCapabilities</td></tr> |
|
97 </table> |
|
98 <h3>Class Methods</h3> |
|
99 <table> |
|
100 <tr><td>None</td></tr> |
|
101 </table> |
|
102 <h3>Methods</h3> |
|
103 <table> |
|
104 <tr> |
|
105 <td><a href="#DebugClientBase.__init__">DebugClientBase</a></td> |
|
106 <td>Constructor</td> |
|
107 </tr><tr> |
|
108 <td><a href="#DebugClientBase.__clientCapabilities">__clientCapabilities</a></td> |
|
109 <td>Private method to determine the clients capabilities.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#DebugClientBase.__completionList">__completionList</a></td> |
|
112 <td>Private slot to handle the request for a commandline completion list.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#DebugClientBase.__dumpThreadList">__dumpThreadList</a></td> |
|
115 <td>Private method to send the list of threads.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#DebugClientBase.__dumpVariable">__dumpVariable</a></td> |
|
118 <td>Private method to return the variables of a frame to the debug server.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#DebugClientBase.__dumpVariables">__dumpVariables</a></td> |
|
121 <td>Private method to return the variables of a frame to the debug server.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#DebugClientBase.__exceptionRaised">__exceptionRaised</a></td> |
|
124 <td>Private method called in the case of an exception.</td> |
|
125 </tr><tr> |
|
126 <td><a href="#DebugClientBase.__formatQtVariable">__formatQtVariable</a></td> |
|
127 <td>Private method to produce a formated output of a simple Qt4/Qt5 type.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#DebugClientBase.__formatVariablesList">__formatVariablesList</a></td> |
|
130 <td>Private method to produce a formated variables list.</td> |
|
131 </tr><tr> |
|
132 <td><a href="#DebugClientBase.__generateFilterObjects">__generateFilterObjects</a></td> |
|
133 <td>Private slot to convert a filter string to a list of filter objects.</td> |
|
134 </tr><tr> |
|
135 <td><a href="#DebugClientBase.__getCompletionList">__getCompletionList</a></td> |
|
136 <td>Private method to create a completions list.</td> |
|
137 </tr><tr> |
|
138 <td><a href="#DebugClientBase.__getSysPath">__getSysPath</a></td> |
|
139 <td>Private slot to calculate a path list including the PYTHONPATH environment variable.</td> |
|
140 </tr><tr> |
|
141 <td><a href="#DebugClientBase.__interact">__interact</a></td> |
|
142 <td>Private method to interact with the debugger.</td> |
|
143 </tr><tr> |
|
144 <td><a href="#DebugClientBase.__interceptSignals">__interceptSignals</a></td> |
|
145 <td>Private method to intercept common signals.</td> |
|
146 </tr><tr> |
|
147 <td><a href="#DebugClientBase.__resolveHost">__resolveHost</a></td> |
|
148 <td>Private method to resolve a hostname to an IP address.</td> |
|
149 </tr><tr> |
|
150 <td><a href="#DebugClientBase.__setCoding">__setCoding</a></td> |
|
151 <td>Private method to set the coding used by a python file.</td> |
|
152 </tr><tr> |
|
153 <td><a href="#DebugClientBase.__signalHandler">__signalHandler</a></td> |
|
154 <td>Private method to handle signals.</td> |
|
155 </tr><tr> |
|
156 <td><a href="#DebugClientBase.__unhandled_exception">__unhandled_exception</a></td> |
|
157 <td>Private method called to report an uncaught exception.</td> |
|
158 </tr><tr> |
|
159 <td><a href="#DebugClientBase.absPath">absPath</a></td> |
|
160 <td>Public method to convert a filename to an absolute name.</td> |
|
161 </tr><tr> |
|
162 <td><a href="#DebugClientBase.attachThread">attachThread</a></td> |
|
163 <td>Public method to setup a thread for DebugClient to debug.</td> |
|
164 </tr><tr> |
|
165 <td><a href="#DebugClientBase.close">close</a></td> |
|
166 <td>Public method implementing a close method as a replacement for os.close().</td> |
|
167 </tr><tr> |
|
168 <td><a href="#DebugClientBase.connectDebugger">connectDebugger</a></td> |
|
169 <td>Public method to establish a session with the debugger.</td> |
|
170 </tr><tr> |
|
171 <td><a href="#DebugClientBase.eventLoop">eventLoop</a></td> |
|
172 <td>Public method implementing our event loop.</td> |
|
173 </tr><tr> |
|
174 <td><a href="#DebugClientBase.eventPoll">eventPoll</a></td> |
|
175 <td>Public method to poll for events like 'set break point'.</td> |
|
176 </tr><tr> |
|
177 <td><a href="#DebugClientBase.fork">fork</a></td> |
|
178 <td>Public method implementing a fork routine deciding which branch to follow.</td> |
|
179 </tr><tr> |
|
180 <td><a href="#DebugClientBase.getCoding">getCoding</a></td> |
|
181 <td>Public method to return the current coding.</td> |
|
182 </tr><tr> |
|
183 <td><a href="#DebugClientBase.getRunning">getRunning</a></td> |
|
184 <td>Public method to return the main script we are currently running.</td> |
|
185 </tr><tr> |
|
186 <td><a href="#DebugClientBase.handleLine">handleLine</a></td> |
|
187 <td>Public method to handle the receipt of a complete line.</td> |
|
188 </tr><tr> |
|
189 <td><a href="#DebugClientBase.input">input</a></td> |
|
190 <td>Public method to implement input() using the event loop.</td> |
|
191 </tr><tr> |
|
192 <td><a href="#DebugClientBase.main">main</a></td> |
|
193 <td>Public method implementing the main method.</td> |
|
194 </tr><tr> |
|
195 <td><a href="#DebugClientBase.progTerminated">progTerminated</a></td> |
|
196 <td>Public method to tell the debugger that the program has terminated.</td> |
|
197 </tr><tr> |
|
198 <td><a href="#DebugClientBase.raw_input">raw_input</a></td> |
|
199 <td>Public method to implement raw_input() using the event loop.</td> |
|
200 </tr><tr> |
|
201 <td><a href="#DebugClientBase.run_call">run_call</a></td> |
|
202 <td>Public method used to start the remote debugger and call a function.</td> |
|
203 </tr><tr> |
|
204 <td><a href="#DebugClientBase.sessionClose">sessionClose</a></td> |
|
205 <td>Public method to close the session with the debugger and optionally terminate.</td> |
|
206 </tr><tr> |
|
207 <td><a href="#DebugClientBase.shouldSkip">shouldSkip</a></td> |
|
208 <td>Public method to check if a file should be skipped.</td> |
|
209 </tr><tr> |
|
210 <td><a href="#DebugClientBase.startDebugger">startDebugger</a></td> |
|
211 <td>Public method used to start the remote debugger.</td> |
|
212 </tr><tr> |
|
213 <td><a href="#DebugClientBase.startProgInDebugger">startProgInDebugger</a></td> |
|
214 <td>Public method used to start the remote debugger.</td> |
|
215 </tr><tr> |
|
216 <td><a href="#DebugClientBase.write">write</a></td> |
|
217 <td>Public method to write data to the output stream.</td> |
|
218 </tr> |
|
219 </table> |
|
220 <h3>Static Methods</h3> |
|
221 <table> |
|
222 <tr><td>None</td></tr> |
|
223 </table> |
|
224 <a NAME="DebugClientBase.__init__" ID="DebugClientBase.__init__"></a> |
|
225 <h4>DebugClientBase (Constructor)</h4> |
|
226 <b>DebugClientBase</b>(<i></i>) |
|
227 <p> |
|
228 Constructor |
|
229 </p><a NAME="DebugClientBase.__clientCapabilities" ID="DebugClientBase.__clientCapabilities"></a> |
|
230 <h4>DebugClientBase.__clientCapabilities</h4> |
|
231 <b>__clientCapabilities</b>(<i></i>) |
|
232 <p> |
|
233 Private method to determine the clients capabilities. |
|
234 </p><dl> |
|
235 <dt>Returns:</dt> |
|
236 <dd> |
|
237 client capabilities (integer) |
|
238 </dd> |
|
239 </dl><a NAME="DebugClientBase.__completionList" ID="DebugClientBase.__completionList"></a> |
|
240 <h4>DebugClientBase.__completionList</h4> |
|
241 <b>__completionList</b>(<i>text</i>) |
|
242 <p> |
|
243 Private slot to handle the request for a commandline completion list. |
|
244 </p><dl> |
|
245 <dt><i>text</i></dt> |
|
246 <dd> |
|
247 the text to be completed (string) |
|
248 </dd> |
|
249 </dl><a NAME="DebugClientBase.__dumpThreadList" ID="DebugClientBase.__dumpThreadList"></a> |
|
250 <h4>DebugClientBase.__dumpThreadList</h4> |
|
251 <b>__dumpThreadList</b>(<i></i>) |
|
252 <p> |
|
253 Private method to send the list of threads. |
|
254 </p><a NAME="DebugClientBase.__dumpVariable" ID="DebugClientBase.__dumpVariable"></a> |
|
255 <h4>DebugClientBase.__dumpVariable</h4> |
|
256 <b>__dumpVariable</b>(<i>var, frmnr, scope, filter</i>) |
|
257 <p> |
|
258 Private method to return the variables of a frame to the debug server. |
|
259 </p><dl> |
|
260 <dt><i>var</i></dt> |
|
261 <dd> |
|
262 list encoded name of the requested variable |
|
263 (list of strings) |
|
264 </dd><dt><i>frmnr</i></dt> |
|
265 <dd> |
|
266 distance of frame reported on. 0 is the current frame |
|
267 (int) |
|
268 </dd><dt><i>scope</i></dt> |
|
269 <dd> |
|
270 1 to report global variables, 0 for local variables (int) |
|
271 </dd><dt><i>filter</i></dt> |
|
272 <dd> |
|
273 the indices of variable types to be filtered |
|
274 (list of int) |
|
275 </dd> |
|
276 </dl><a NAME="DebugClientBase.__dumpVariables" ID="DebugClientBase.__dumpVariables"></a> |
|
277 <h4>DebugClientBase.__dumpVariables</h4> |
|
278 <b>__dumpVariables</b>(<i>frmnr, scope, filter</i>) |
|
279 <p> |
|
280 Private method to return the variables of a frame to the debug server. |
|
281 </p><dl> |
|
282 <dt><i>frmnr</i></dt> |
|
283 <dd> |
|
284 distance of frame reported on. 0 is the current frame |
|
285 (int) |
|
286 </dd><dt><i>scope</i></dt> |
|
287 <dd> |
|
288 1 to report global variables, 0 for local variables (int) |
|
289 </dd><dt><i>filter</i></dt> |
|
290 <dd> |
|
291 the indices of variable types to be filtered (list of |
|
292 int) |
|
293 </dd> |
|
294 </dl><a NAME="DebugClientBase.__exceptionRaised" ID="DebugClientBase.__exceptionRaised"></a> |
|
295 <h4>DebugClientBase.__exceptionRaised</h4> |
|
296 <b>__exceptionRaised</b>(<i></i>) |
|
297 <p> |
|
298 Private method called in the case of an exception. |
|
299 </p><p> |
|
300 It ensures that the debug server is informed of the raised exception. |
|
301 </p><a NAME="DebugClientBase.__formatQtVariable" ID="DebugClientBase.__formatQtVariable"></a> |
|
302 <h4>DebugClientBase.__formatQtVariable</h4> |
|
303 <b>__formatQtVariable</b>(<i>value, vtype</i>) |
|
304 <p> |
|
305 Private method to produce a formated output of a simple Qt4/Qt5 type. |
|
306 </p><dl> |
|
307 <dt><i>value</i></dt> |
|
308 <dd> |
|
309 variable to be formated |
|
310 </dd><dt><i>vtype</i></dt> |
|
311 <dd> |
|
312 type of the variable to be formatted (string) |
|
313 </dd> |
|
314 </dl><dl> |
|
315 <dt>Returns:</dt> |
|
316 <dd> |
|
317 A tuple consisting of a list of formatted variables. Each |
|
318 variable entry is a tuple of three elements, the variable name, |
|
319 its type and value. |
|
320 </dd> |
|
321 </dl><a NAME="DebugClientBase.__formatVariablesList" ID="DebugClientBase.__formatVariablesList"></a> |
|
322 <h4>DebugClientBase.__formatVariablesList</h4> |
|
323 <b>__formatVariablesList</b>(<i>keylist, dict, scope, filter=[], formatSequences=0</i>) |
|
324 <p> |
|
325 Private method to produce a formated variables list. |
|
326 </p><p> |
|
327 The dictionary passed in to it is scanned. Variables are |
|
328 only added to the list, if their type is not contained |
|
329 in the filter list and their name doesn't match any of |
|
330 the filter expressions. The formated variables list (a list of tuples |
|
331 of 3 values) is returned. |
|
332 </p><dl> |
|
333 <dt><i>keylist</i></dt> |
|
334 <dd> |
|
335 keys of the dictionary |
|
336 </dd><dt><i>dict</i></dt> |
|
337 <dd> |
|
338 the dictionary to be scanned |
|
339 </dd><dt><i>scope</i></dt> |
|
340 <dd> |
|
341 1 to filter using the globals filter, 0 using the locals |
|
342 filter (int). |
|
343 Variables are only added to the list, if their name do not match |
|
344 any of the filter expressions. |
|
345 </dd><dt><i>filter</i></dt> |
|
346 <dd> |
|
347 the indices of variable types to be filtered. Variables |
|
348 are only added to the list, if their type is not contained in the |
|
349 filter list. |
|
350 </dd><dt><i>formatSequences</i></dt> |
|
351 <dd> |
|
352 flag indicating, that sequence or dictionary |
|
353 variables should be formatted. If it is 0 (or false), just the |
|
354 number of items contained in these variables is returned. (boolean) |
|
355 </dd> |
|
356 </dl><dl> |
|
357 <dt>Returns:</dt> |
|
358 <dd> |
|
359 A tuple consisting of a list of formatted variables. Each |
|
360 variable entry is a tuple of three elements, the variable name, |
|
361 its type and value. |
|
362 </dd> |
|
363 </dl><a NAME="DebugClientBase.__generateFilterObjects" ID="DebugClientBase.__generateFilterObjects"></a> |
|
364 <h4>DebugClientBase.__generateFilterObjects</h4> |
|
365 <b>__generateFilterObjects</b>(<i>scope, filterString</i>) |
|
366 <p> |
|
367 Private slot to convert a filter string to a list of filter objects. |
|
368 </p><dl> |
|
369 <dt><i>scope</i></dt> |
|
370 <dd> |
|
371 1 to generate filter for global variables, 0 for local |
|
372 variables (int) |
|
373 </dd><dt><i>filterString</i></dt> |
|
374 <dd> |
|
375 string of filter patterns separated by ';' |
|
376 </dd> |
|
377 </dl><a NAME="DebugClientBase.__getCompletionList" ID="DebugClientBase.__getCompletionList"></a> |
|
378 <h4>DebugClientBase.__getCompletionList</h4> |
|
379 <b>__getCompletionList</b>(<i>text, completer, completions</i>) |
|
380 <p> |
|
381 Private method to create a completions list. |
|
382 </p><dl> |
|
383 <dt><i>text</i></dt> |
|
384 <dd> |
|
385 text to complete (string) |
|
386 </dd><dt><i>completer</i></dt> |
|
387 <dd> |
|
388 completer methode |
|
389 </dd><dt><i>completions</i></dt> |
|
390 <dd> |
|
391 set where to add new completions strings (set) |
|
392 </dd> |
|
393 </dl><a NAME="DebugClientBase.__getSysPath" ID="DebugClientBase.__getSysPath"></a> |
|
394 <h4>DebugClientBase.__getSysPath</h4> |
|
395 <b>__getSysPath</b>(<i>firstEntry</i>) |
|
396 <p> |
|
397 Private slot to calculate a path list including the PYTHONPATH |
|
398 environment variable. |
|
399 </p><dl> |
|
400 <dt><i>firstEntry</i></dt> |
|
401 <dd> |
|
402 entry to be put first in sys.path (string) |
|
403 </dd> |
|
404 </dl><dl> |
|
405 <dt>Returns:</dt> |
|
406 <dd> |
|
407 path list for use as sys.path (list of strings) |
|
408 </dd> |
|
409 </dl><a NAME="DebugClientBase.__interact" ID="DebugClientBase.__interact"></a> |
|
410 <h4>DebugClientBase.__interact</h4> |
|
411 <b>__interact</b>(<i></i>) |
|
412 <p> |
|
413 Private method to interact with the debugger. |
|
414 </p><a NAME="DebugClientBase.__interceptSignals" ID="DebugClientBase.__interceptSignals"></a> |
|
415 <h4>DebugClientBase.__interceptSignals</h4> |
|
416 <b>__interceptSignals</b>(<i></i>) |
|
417 <p> |
|
418 Private method to intercept common signals. |
|
419 </p><a NAME="DebugClientBase.__resolveHost" ID="DebugClientBase.__resolveHost"></a> |
|
420 <h4>DebugClientBase.__resolveHost</h4> |
|
421 <b>__resolveHost</b>(<i>host</i>) |
|
422 <p> |
|
423 Private method to resolve a hostname to an IP address. |
|
424 </p><dl> |
|
425 <dt><i>host</i></dt> |
|
426 <dd> |
|
427 hostname of the debug server (string) |
|
428 </dd> |
|
429 </dl><dl> |
|
430 <dt>Returns:</dt> |
|
431 <dd> |
|
432 IP address (string) |
|
433 </dd> |
|
434 </dl><a NAME="DebugClientBase.__setCoding" ID="DebugClientBase.__setCoding"></a> |
|
435 <h4>DebugClientBase.__setCoding</h4> |
|
436 <b>__setCoding</b>(<i>filename</i>) |
|
437 <p> |
|
438 Private method to set the coding used by a python file. |
|
439 </p><dl> |
|
440 <dt><i>filename</i></dt> |
|
441 <dd> |
|
442 name of the file to inspect (string) |
|
443 </dd> |
|
444 </dl><a NAME="DebugClientBase.__signalHandler" ID="DebugClientBase.__signalHandler"></a> |
|
445 <h4>DebugClientBase.__signalHandler</h4> |
|
446 <b>__signalHandler</b>(<i>signalNumber, stackFrame</i>) |
|
447 <p> |
|
448 Private method to handle signals. |
|
449 </p><dl> |
|
450 <dt><i>signalNumber</i> (int)</dt> |
|
451 <dd> |
|
452 number of the signal to be handled |
|
453 </dd><dt><i>stackFrame</i> (frame object)</dt> |
|
454 <dd> |
|
455 current stack frame |
|
456 </dd> |
|
457 </dl><a NAME="DebugClientBase.__unhandled_exception" ID="DebugClientBase.__unhandled_exception"></a> |
|
458 <h4>DebugClientBase.__unhandled_exception</h4> |
|
459 <b>__unhandled_exception</b>(<i>exctype, excval, exctb</i>) |
|
460 <p> |
|
461 Private method called to report an uncaught exception. |
|
462 </p><dl> |
|
463 <dt><i>exctype</i></dt> |
|
464 <dd> |
|
465 the type of the exception |
|
466 </dd><dt><i>excval</i></dt> |
|
467 <dd> |
|
468 data about the exception |
|
469 </dd><dt><i>exctb</i></dt> |
|
470 <dd> |
|
471 traceback for the exception |
|
472 </dd> |
|
473 </dl><a NAME="DebugClientBase.absPath" ID="DebugClientBase.absPath"></a> |
|
474 <h4>DebugClientBase.absPath</h4> |
|
475 <b>absPath</b>(<i>fn</i>) |
|
476 <p> |
|
477 Public method to convert a filename to an absolute name. |
|
478 </p><p> |
|
479 sys.path is used as a set of possible prefixes. The name stays |
|
480 relative if a file could not be found. |
|
481 </p><dl> |
|
482 <dt><i>fn</i></dt> |
|
483 <dd> |
|
484 filename (string) |
|
485 </dd> |
|
486 </dl><dl> |
|
487 <dt>Returns:</dt> |
|
488 <dd> |
|
489 the converted filename (string) |
|
490 </dd> |
|
491 </dl><a NAME="DebugClientBase.attachThread" ID="DebugClientBase.attachThread"></a> |
|
492 <h4>DebugClientBase.attachThread</h4> |
|
493 <b>attachThread</b>(<i>target=None, args=None, kwargs=None, mainThread=0</i>) |
|
494 <p> |
|
495 Public method to setup a thread for DebugClient to debug. |
|
496 </p><p> |
|
497 If mainThread is non-zero, then we are attaching to the already |
|
498 started mainthread of the app and the rest of the args are ignored. |
|
499 </p><p> |
|
500 This is just an empty function and is overridden in the threaded |
|
501 debugger. |
|
502 </p><dl> |
|
503 <dt><i>target</i></dt> |
|
504 <dd> |
|
505 the start function of the target thread (i.e. the user |
|
506 code) |
|
507 </dd><dt><i>args</i></dt> |
|
508 <dd> |
|
509 arguments to pass to target |
|
510 </dd><dt><i>kwargs</i></dt> |
|
511 <dd> |
|
512 keyword arguments to pass to target |
|
513 </dd><dt><i>mainThread</i></dt> |
|
514 <dd> |
|
515 non-zero, if we are attaching to the already |
|
516 started mainthread of the app |
|
517 </dd> |
|
518 </dl><a NAME="DebugClientBase.close" ID="DebugClientBase.close"></a> |
|
519 <h4>DebugClientBase.close</h4> |
|
520 <b>close</b>(<i>fd</i>) |
|
521 <p> |
|
522 Public method implementing a close method as a replacement for |
|
523 os.close(). |
|
524 </p><p> |
|
525 It prevents the debugger connections from being closed. |
|
526 </p><dl> |
|
527 <dt><i>fd</i></dt> |
|
528 <dd> |
|
529 file descriptor to be closed (integer) |
|
530 </dd> |
|
531 </dl><a NAME="DebugClientBase.connectDebugger" ID="DebugClientBase.connectDebugger"></a> |
|
532 <h4>DebugClientBase.connectDebugger</h4> |
|
533 <b>connectDebugger</b>(<i>port, remoteAddress=None, redirect=1</i>) |
|
534 <p> |
|
535 Public method to establish a session with the debugger. |
|
536 </p><p> |
|
537 It opens a network connection to the debugger, connects it to stdin, |
|
538 stdout and stderr and saves these file objects in case the application |
|
539 being debugged redirects them itself. |
|
540 </p><dl> |
|
541 <dt><i>port</i></dt> |
|
542 <dd> |
|
543 the port number to connect to (int) |
|
544 </dd><dt><i>remoteAddress</i></dt> |
|
545 <dd> |
|
546 the network address of the debug server host |
|
547 (string) |
|
548 </dd><dt><i>redirect</i></dt> |
|
549 <dd> |
|
550 flag indicating redirection of stdin, stdout and |
|
551 stderr (boolean) |
|
552 </dd> |
|
553 </dl><a NAME="DebugClientBase.eventLoop" ID="DebugClientBase.eventLoop"></a> |
|
554 <h4>DebugClientBase.eventLoop</h4> |
|
555 <b>eventLoop</b>(<i>disablePolling=False</i>) |
|
556 <p> |
|
557 Public method implementing our event loop. |
|
558 </p><dl> |
|
559 <dt><i>disablePolling</i></dt> |
|
560 <dd> |
|
561 flag indicating to enter an event loop with |
|
562 polling disabled (boolean) |
|
563 </dd> |
|
564 </dl><a NAME="DebugClientBase.eventPoll" ID="DebugClientBase.eventPoll"></a> |
|
565 <h4>DebugClientBase.eventPoll</h4> |
|
566 <b>eventPoll</b>(<i></i>) |
|
567 <p> |
|
568 Public method to poll for events like 'set break point'. |
|
569 </p><a NAME="DebugClientBase.fork" ID="DebugClientBase.fork"></a> |
|
570 <h4>DebugClientBase.fork</h4> |
|
571 <b>fork</b>(<i></i>) |
|
572 <p> |
|
573 Public method implementing a fork routine deciding which branch to |
|
574 follow. |
|
575 </p><dl> |
|
576 <dt>Returns:</dt> |
|
577 <dd> |
|
578 process ID (integer) |
|
579 </dd> |
|
580 </dl><a NAME="DebugClientBase.getCoding" ID="DebugClientBase.getCoding"></a> |
|
581 <h4>DebugClientBase.getCoding</h4> |
|
582 <b>getCoding</b>(<i></i>) |
|
583 <p> |
|
584 Public method to return the current coding. |
|
585 </p><dl> |
|
586 <dt>Returns:</dt> |
|
587 <dd> |
|
588 codec name (string) |
|
589 </dd> |
|
590 </dl><a NAME="DebugClientBase.getRunning" ID="DebugClientBase.getRunning"></a> |
|
591 <h4>DebugClientBase.getRunning</h4> |
|
592 <b>getRunning</b>(<i></i>) |
|
593 <p> |
|
594 Public method to return the main script we are currently running. |
|
595 </p><dl> |
|
596 <dt>Returns:</dt> |
|
597 <dd> |
|
598 flag indicating a running debug session (boolean) |
|
599 </dd> |
|
600 </dl><a NAME="DebugClientBase.handleLine" ID="DebugClientBase.handleLine"></a> |
|
601 <h4>DebugClientBase.handleLine</h4> |
|
602 <b>handleLine</b>(<i>line</i>) |
|
603 <p> |
|
604 Public method to handle the receipt of a complete line. |
|
605 </p><p> |
|
606 It first looks for a valid protocol token at the start of the line. |
|
607 Thereafter it trys to execute the lines accumulated so far. |
|
608 </p><dl> |
|
609 <dt><i>line</i></dt> |
|
610 <dd> |
|
611 the received line |
|
612 </dd> |
|
613 </dl><a NAME="DebugClientBase.input" ID="DebugClientBase.input"></a> |
|
614 <h4>DebugClientBase.input</h4> |
|
615 <b>input</b>(<i>prompt</i>) |
|
616 <p> |
|
617 Public method to implement input() using the event loop. |
|
618 </p><dl> |
|
619 <dt><i>prompt</i></dt> |
|
620 <dd> |
|
621 the prompt to be shown (string) |
|
622 </dd> |
|
623 </dl><dl> |
|
624 <dt>Returns:</dt> |
|
625 <dd> |
|
626 the entered string evaluated as a Python expresion |
|
627 </dd> |
|
628 </dl><a NAME="DebugClientBase.main" ID="DebugClientBase.main"></a> |
|
629 <h4>DebugClientBase.main</h4> |
|
630 <b>main</b>(<i></i>) |
|
631 <p> |
|
632 Public method implementing the main method. |
|
633 </p><a NAME="DebugClientBase.progTerminated" ID="DebugClientBase.progTerminated"></a> |
|
634 <h4>DebugClientBase.progTerminated</h4> |
|
635 <b>progTerminated</b>(<i>status</i>) |
|
636 <p> |
|
637 Public method to tell the debugger that the program has terminated. |
|
638 </p><dl> |
|
639 <dt><i>status</i> (int)</dt> |
|
640 <dd> |
|
641 return status |
|
642 </dd> |
|
643 </dl><a NAME="DebugClientBase.raw_input" ID="DebugClientBase.raw_input"></a> |
|
644 <h4>DebugClientBase.raw_input</h4> |
|
645 <b>raw_input</b>(<i>prompt, echo</i>) |
|
646 <p> |
|
647 Public method to implement raw_input() using the event loop. |
|
648 </p><dl> |
|
649 <dt><i>prompt</i></dt> |
|
650 <dd> |
|
651 the prompt to be shown (string) |
|
652 </dd><dt><i>echo</i></dt> |
|
653 <dd> |
|
654 Flag indicating echoing of the input (boolean) |
|
655 </dd> |
|
656 </dl><dl> |
|
657 <dt>Returns:</dt> |
|
658 <dd> |
|
659 the entered string |
|
660 </dd> |
|
661 </dl><a NAME="DebugClientBase.run_call" ID="DebugClientBase.run_call"></a> |
|
662 <h4>DebugClientBase.run_call</h4> |
|
663 <b>run_call</b>(<i>scriptname, func, *args</i>) |
|
664 <p> |
|
665 Public method used to start the remote debugger and call a function. |
|
666 </p><dl> |
|
667 <dt><i>scriptname</i></dt> |
|
668 <dd> |
|
669 name of the script to be debugged (string) |
|
670 </dd><dt><i>func</i></dt> |
|
671 <dd> |
|
672 function to be called |
|
673 </dd><dt><i>*args</i></dt> |
|
674 <dd> |
|
675 arguments being passed to func |
|
676 </dd> |
|
677 </dl><dl> |
|
678 <dt>Returns:</dt> |
|
679 <dd> |
|
680 result of the function call |
|
681 </dd> |
|
682 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a> |
|
683 <h4>DebugClientBase.sessionClose</h4> |
|
684 <b>sessionClose</b>(<i>exit=1</i>) |
|
685 <p> |
|
686 Public method to close the session with the debugger and optionally |
|
687 terminate. |
|
688 </p><dl> |
|
689 <dt><i>exit</i></dt> |
|
690 <dd> |
|
691 flag indicating to terminate (boolean) |
|
692 </dd> |
|
693 </dl><a NAME="DebugClientBase.shouldSkip" ID="DebugClientBase.shouldSkip"></a> |
|
694 <h4>DebugClientBase.shouldSkip</h4> |
|
695 <b>shouldSkip</b>(<i>fn</i>) |
|
696 <p> |
|
697 Public method to check if a file should be skipped. |
|
698 </p><dl> |
|
699 <dt><i>fn</i></dt> |
|
700 <dd> |
|
701 filename to be checked |
|
702 </dd> |
|
703 </dl><dl> |
|
704 <dt>Returns:</dt> |
|
705 <dd> |
|
706 non-zero if fn represents a file we are 'skipping', |
|
707 zero otherwise. |
|
708 </dd> |
|
709 </dl><a NAME="DebugClientBase.startDebugger" ID="DebugClientBase.startDebugger"></a> |
|
710 <h4>DebugClientBase.startDebugger</h4> |
|
711 <b>startDebugger</b>(<i>filename=None, host=None, port=None, enableTrace=1, exceptions=1, tracePython=0, redirect=1</i>) |
|
712 <p> |
|
713 Public method used to start the remote debugger. |
|
714 </p><dl> |
|
715 <dt><i>filename</i></dt> |
|
716 <dd> |
|
717 the program to be debugged (string) |
|
718 </dd><dt><i>host</i></dt> |
|
719 <dd> |
|
720 hostname of the debug server (string) |
|
721 </dd><dt><i>port</i></dt> |
|
722 <dd> |
|
723 portnumber of the debug server (int) |
|
724 </dd><dt><i>enableTrace</i></dt> |
|
725 <dd> |
|
726 flag to enable the tracing function (boolean) |
|
727 </dd><dt><i>exceptions</i></dt> |
|
728 <dd> |
|
729 flag to enable exception reporting of the IDE |
|
730 (boolean) |
|
731 </dd><dt><i>tracePython</i></dt> |
|
732 <dd> |
|
733 flag to enable tracing into the Python library |
|
734 (boolean) |
|
735 </dd><dt><i>redirect</i></dt> |
|
736 <dd> |
|
737 flag indicating redirection of stdin, stdout and |
|
738 stderr (boolean) |
|
739 </dd> |
|
740 </dl><a NAME="DebugClientBase.startProgInDebugger" ID="DebugClientBase.startProgInDebugger"></a> |
|
741 <h4>DebugClientBase.startProgInDebugger</h4> |
|
742 <b>startProgInDebugger</b>(<i>progargs, wd='', host=None, port=None, exceptions=1, tracePython=0, redirect=1</i>) |
|
743 <p> |
|
744 Public method used to start the remote debugger. |
|
745 </p><dl> |
|
746 <dt><i>progargs</i></dt> |
|
747 <dd> |
|
748 commandline for the program to be debugged |
|
749 (list of strings) |
|
750 </dd><dt><i>wd</i></dt> |
|
751 <dd> |
|
752 working directory for the program execution (string) |
|
753 </dd><dt><i>host</i></dt> |
|
754 <dd> |
|
755 hostname of the debug server (string) |
|
756 </dd><dt><i>port</i></dt> |
|
757 <dd> |
|
758 portnumber of the debug server (int) |
|
759 </dd><dt><i>exceptions</i></dt> |
|
760 <dd> |
|
761 flag to enable exception reporting of the IDE |
|
762 (boolean) |
|
763 </dd><dt><i>tracePython</i></dt> |
|
764 <dd> |
|
765 flag to enable tracing into the Python library |
|
766 (boolean) |
|
767 </dd><dt><i>redirect</i></dt> |
|
768 <dd> |
|
769 flag indicating redirection of stdin, stdout and |
|
770 stderr (boolean) |
|
771 </dd> |
|
772 </dl><a NAME="DebugClientBase.write" ID="DebugClientBase.write"></a> |
|
773 <h4>DebugClientBase.write</h4> |
|
774 <b>write</b>(<i>s</i>) |
|
775 <p> |
|
776 Public method to write data to the output stream. |
|
777 </p><dl> |
|
778 <dt><i>s</i></dt> |
|
779 <dd> |
|
780 data to be written (string) |
|
781 </dd> |
|
782 </dl> |
|
783 <div align="right"><a href="#top">Up</a></div> |
|
784 <hr /><hr /> |
|
785 <a NAME="DebugClientClose" ID="DebugClientClose"></a> |
|
786 <h2>DebugClientClose</h2> |
|
787 <b>DebugClientClose</b>(<i>fd</i>) |
|
788 <p> |
|
789 Replacement for the standard os.close(fd). |
|
790 </p><dl> |
|
791 <dt><i>fd</i></dt> |
|
792 <dd> |
|
793 open file descriptor to be closed (integer) |
|
794 </dd> |
|
795 </dl> |
|
796 <div align="right"><a href="#top">Up</a></div> |
|
797 <hr /><hr /> |
|
798 <a NAME="DebugClientFork" ID="DebugClientFork"></a> |
|
799 <h2>DebugClientFork</h2> |
|
800 <b>DebugClientFork</b>(<i></i>) |
|
801 <p> |
|
802 Replacement for the standard os.fork(). |
|
803 </p><dl> |
|
804 <dt>Returns:</dt> |
|
805 <dd> |
|
806 result of the fork() call |
|
807 </dd> |
|
808 </dl> |
|
809 <div align="right"><a href="#top">Up</a></div> |
|
810 <hr /><hr /> |
|
811 <a NAME="DebugClientInput" ID="DebugClientInput"></a> |
|
812 <h2>DebugClientInput</h2> |
|
813 <b>DebugClientInput</b>(<i>prompt=""</i>) |
|
814 <p> |
|
815 Replacement for the standard input builtin. |
|
816 </p><p> |
|
817 This function works with the split debugger. |
|
818 </p><dl> |
|
819 <dt><i>prompt</i></dt> |
|
820 <dd> |
|
821 prompt to be shown (string) |
|
822 </dd> |
|
823 </dl><dl> |
|
824 <dt>Returns:</dt> |
|
825 <dd> |
|
826 result of the input() call |
|
827 </dd> |
|
828 </dl> |
|
829 <div align="right"><a href="#top">Up</a></div> |
|
830 <hr /><hr /> |
|
831 <a NAME="DebugClientRawInput" ID="DebugClientRawInput"></a> |
|
832 <h2>DebugClientRawInput</h2> |
|
833 <b>DebugClientRawInput</b>(<i>prompt="", echo=1</i>) |
|
834 <p> |
|
835 Replacement for the standard raw_input builtin. |
|
836 </p><p> |
|
837 This function works with the split debugger. |
|
838 </p><dl> |
|
839 <dt><i>prompt</i></dt> |
|
840 <dd> |
|
841 prompt to be shown. (string) |
|
842 </dd><dt><i>echo</i></dt> |
|
843 <dd> |
|
844 flag indicating echoing of the input (boolean) |
|
845 </dd> |
|
846 </dl><dl> |
|
847 <dt>Returns:</dt> |
|
848 <dd> |
|
849 result of the raw_input() call |
|
850 </dd> |
|
851 </dl> |
|
852 <div align="right"><a href="#top">Up</a></div> |
|
853 <hr /><hr /> |
|
854 <a NAME="DebugClientSetRecursionLimit" ID="DebugClientSetRecursionLimit"></a> |
|
855 <h2>DebugClientSetRecursionLimit</h2> |
|
856 <b>DebugClientSetRecursionLimit</b>(<i>limit</i>) |
|
857 <p> |
|
858 Replacement for the standard sys.setrecursionlimit(limit). |
|
859 </p><dl> |
|
860 <dt><i>limit</i></dt> |
|
861 <dd> |
|
862 recursion limit (integer) |
|
863 </dd> |
|
864 </dl> |
|
865 <div align="right"><a href="#top">Up</a></div> |
|
866 <hr /> |
|
867 </body></html> |
|