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