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