|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.DebugClients.Python.DebugBase</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.DebugClients.Python.DebugBase</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the debug base class which based originally on bdb. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>gRecursionLimit</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#DebugBase">DebugBase</a></td> |
|
25 <td>Class implementing base class of the debugger.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 |
|
32 <tr> |
|
33 <td><a href="#printerr">printerr</a></td> |
|
34 <td>Module function used for debugging the debug client.</td> |
|
35 </tr> |
|
36 <tr> |
|
37 <td><a href="#setRecursionLimit">setRecursionLimit</a></td> |
|
38 <td>Module function to set the recursion limit.</td> |
|
39 </tr> |
|
40 </table> |
|
41 <hr /> |
|
42 <hr /> |
|
43 <a NAME="DebugBase" ID="DebugBase"></a> |
|
44 <h2>DebugBase</h2> |
|
45 |
|
46 <p> |
|
47 Class implementing base class of the debugger. |
|
48 </p> |
|
49 <p> |
|
50 Provides methods for the 'owning' client to call to step etc. |
|
51 </p> |
|
52 <h3>Derived from</h3> |
|
53 None |
|
54 <h3>Class Attributes</h3> |
|
55 |
|
56 <table> |
|
57 <tr><td>_fnCache</td></tr><tr><td>filesToSkip</td></tr><tr><td>lib</td></tr><tr><td>pathsToSkip</td></tr><tr><td>pollTimerEnabled</td></tr> |
|
58 </table> |
|
59 <h3>Class Methods</h3> |
|
60 |
|
61 <table> |
|
62 <tr><td>None</td></tr> |
|
63 </table> |
|
64 <h3>Methods</h3> |
|
65 |
|
66 <table> |
|
67 |
|
68 <tr> |
|
69 <td><a href="#DebugBase.__init__">DebugBase</a></td> |
|
70 <td>Constructor</td> |
|
71 </tr> |
|
72 <tr> |
|
73 <td><a href="#DebugBase.__checkBreakInFrame">__checkBreakInFrame</a></td> |
|
74 <td>Private method to check if the function / method has a line number which is a breakpoint.</td> |
|
75 </tr> |
|
76 <tr> |
|
77 <td><a href="#DebugBase.__disassemble">__disassemble</a></td> |
|
78 <td>Private method to generate a disassembly of the given code object.</td> |
|
79 </tr> |
|
80 <tr> |
|
81 <td><a href="#DebugBase.__do_clearBreak">__do_clearBreak</a></td> |
|
82 <td>Private method called to clear a temporary breakpoint.</td> |
|
83 </tr> |
|
84 <tr> |
|
85 <td><a href="#DebugBase.__do_clearWatch">__do_clearWatch</a></td> |
|
86 <td>Private method called to clear a temporary watch expression.</td> |
|
87 </tr> |
|
88 <tr> |
|
89 <td><a href="#DebugBase.__eventPollTimer">__eventPollTimer</a></td> |
|
90 <td>Private method to set a flag every 0.5 s to check for new messages.</td> |
|
91 </tr> |
|
92 <tr> |
|
93 <td><a href="#DebugBase.__extractExceptionName">__extractExceptionName</a></td> |
|
94 <td>Private method to extract the exception name given the exception type object.</td> |
|
95 </tr> |
|
96 <tr> |
|
97 <td><a href="#DebugBase.__extractSystemExitMessage">__extractSystemExitMessage</a></td> |
|
98 <td>Private method to get the SystemExit code and message.</td> |
|
99 </tr> |
|
100 <tr> |
|
101 <td><a href="#DebugBase.__extract_stack">__extract_stack</a></td> |
|
102 <td>Private member to return a list of stack frames.</td> |
|
103 </tr> |
|
104 <tr> |
|
105 <td><a href="#DebugBase.__sendCallTrace">__sendCallTrace</a></td> |
|
106 <td>Private method to send a call/return trace.</td> |
|
107 </tr> |
|
108 <tr> |
|
109 <td><a href="#DebugBase.__skipFrame">__skipFrame</a></td> |
|
110 <td>Private method to filter out debugger files.</td> |
|
111 </tr> |
|
112 <tr> |
|
113 <td><a href="#DebugBase._set_stopinfo">_set_stopinfo</a></td> |
|
114 <td>Protected method to update the frame pointers.</td> |
|
115 </tr> |
|
116 <tr> |
|
117 <td><a href="#DebugBase.bootstrap">bootstrap</a></td> |
|
118 <td>Public method to bootstrap a thread.</td> |
|
119 </tr> |
|
120 <tr> |
|
121 <td><a href="#DebugBase.break_here">break_here</a></td> |
|
122 <td>Public method reimplemented from bdb.py to fix the filename from the frame.</td> |
|
123 </tr> |
|
124 <tr> |
|
125 <td><a href="#DebugBase.fix_frame_filename">fix_frame_filename</a></td> |
|
126 <td>Public method used to fixup the filename for a given frame.</td> |
|
127 </tr> |
|
128 <tr> |
|
129 <td><a href="#DebugBase.getCurrentFrame">getCurrentFrame</a></td> |
|
130 <td>Public method to return the current frame.</td> |
|
131 </tr> |
|
132 <tr> |
|
133 <td><a href="#DebugBase.getFrameLocals">getFrameLocals</a></td> |
|
134 <td>Public method to return the locals dictionary of the current frame or a frame below.</td> |
|
135 </tr> |
|
136 <tr> |
|
137 <td><a href="#DebugBase.getStack">getStack</a></td> |
|
138 <td>Public method to get the stack.</td> |
|
139 </tr> |
|
140 <tr> |
|
141 <td><a href="#DebugBase.go">go</a></td> |
|
142 <td>Public method to resume the thread.</td> |
|
143 </tr> |
|
144 <tr> |
|
145 <td><a href="#DebugBase.move_instruction_pointer">move_instruction_pointer</a></td> |
|
146 <td>Public method to move the instruction pointer to another line.</td> |
|
147 </tr> |
|
148 <tr> |
|
149 <td><a href="#DebugBase.profile">profile</a></td> |
|
150 <td>Public method used to trace some stuff independent of the debugger trace function.</td> |
|
151 </tr> |
|
152 <tr> |
|
153 <td><a href="#DebugBase.profileWithRecursion">profileWithRecursion</a></td> |
|
154 <td>Public method used to trace some stuff independent of the debugger trace function.</td> |
|
155 </tr> |
|
156 <tr> |
|
157 <td><a href="#DebugBase.run">run</a></td> |
|
158 <td>Public method to start a given command under debugger control.</td> |
|
159 </tr> |
|
160 <tr> |
|
161 <td><a href="#DebugBase.setRecursionDepth">setRecursionDepth</a></td> |
|
162 <td>Public method to determine the current recursion depth.</td> |
|
163 </tr> |
|
164 <tr> |
|
165 <td><a href="#DebugBase.set_continue">set_continue</a></td> |
|
166 <td>Public method to stop only on next breakpoint.</td> |
|
167 </tr> |
|
168 <tr> |
|
169 <td><a href="#DebugBase.set_next">set_next</a></td> |
|
170 <td>Public method to stop on the next line in or below the given frame.</td> |
|
171 </tr> |
|
172 <tr> |
|
173 <td><a href="#DebugBase.set_quit">set_quit</a></td> |
|
174 <td>Public method to quit.</td> |
|
175 </tr> |
|
176 <tr> |
|
177 <td><a href="#DebugBase.set_return">set_return</a></td> |
|
178 <td>Public method to stop when returning from the given frame.</td> |
|
179 </tr> |
|
180 <tr> |
|
181 <td><a href="#DebugBase.set_step">set_step</a></td> |
|
182 <td>Public method to stop after one line of code.</td> |
|
183 </tr> |
|
184 <tr> |
|
185 <td><a href="#DebugBase.set_trace">set_trace</a></td> |
|
186 <td>Public method to start debugging from 'frame'.</td> |
|
187 </tr> |
|
188 <tr> |
|
189 <td><a href="#DebugBase.set_until">set_until</a></td> |
|
190 <td>Public method to stop when the line with the lineno greater than the current one is reached or when returning from current frame.</td> |
|
191 </tr> |
|
192 <tr> |
|
193 <td><a href="#DebugBase.step">step</a></td> |
|
194 <td>Public method to perform a step operation in this thread.</td> |
|
195 </tr> |
|
196 <tr> |
|
197 <td><a href="#DebugBase.stepOut">stepOut</a></td> |
|
198 <td>Public method to perform a step out of the current call.</td> |
|
199 </tr> |
|
200 <tr> |
|
201 <td><a href="#DebugBase.stop_here">stop_here</a></td> |
|
202 <td>Public method reimplemented to filter out debugger files.</td> |
|
203 </tr> |
|
204 <tr> |
|
205 <td><a href="#DebugBase.storeFrameLocals">storeFrameLocals</a></td> |
|
206 <td>Public method to store the locals into the frame, so an access to frame.f_locals returns the last data.</td> |
|
207 </tr> |
|
208 <tr> |
|
209 <td><a href="#DebugBase.tracePythonLibs">tracePythonLibs</a></td> |
|
210 <td>Public method to update the settings to trace into Python libraries.</td> |
|
211 </tr> |
|
212 <tr> |
|
213 <td><a href="#DebugBase.trace_dispatch">trace_dispatch</a></td> |
|
214 <td>Public method reimplemented from bdb.py to do some special things.</td> |
|
215 </tr> |
|
216 <tr> |
|
217 <td><a href="#DebugBase.user_exception">user_exception</a></td> |
|
218 <td>Public method reimplemented to report an exception to the debug server.</td> |
|
219 </tr> |
|
220 <tr> |
|
221 <td><a href="#DebugBase.user_line">user_line</a></td> |
|
222 <td>Public method reimplemented to handle the program about to execute a particular line.</td> |
|
223 </tr> |
|
224 </table> |
|
225 <h3>Static Methods</h3> |
|
226 |
|
227 <table> |
|
228 <tr><td>None</td></tr> |
|
229 </table> |
|
230 |
|
231 <a NAME="DebugBase.__init__" ID="DebugBase.__init__"></a> |
|
232 <h4>DebugBase (Constructor)</h4> |
|
233 <b>DebugBase</b>(<i>dbgClient</i>) |
|
234 |
|
235 <p> |
|
236 Constructor |
|
237 </p> |
|
238 <dl> |
|
239 |
|
240 <dt><i>dbgClient</i></dt> |
|
241 <dd> |
|
242 the owning client |
|
243 </dd> |
|
244 </dl> |
|
245 <a NAME="DebugBase.__checkBreakInFrame" ID="DebugBase.__checkBreakInFrame"></a> |
|
246 <h4>DebugBase.__checkBreakInFrame</h4> |
|
247 <b>__checkBreakInFrame</b>(<i>frame</i>) |
|
248 |
|
249 <p> |
|
250 Private method to check if the function / method has a line number |
|
251 which is a breakpoint. |
|
252 </p> |
|
253 <dl> |
|
254 |
|
255 <dt><i>frame</i> (frame object)</dt> |
|
256 <dd> |
|
257 the frame object |
|
258 </dd> |
|
259 </dl> |
|
260 <dl> |
|
261 <dt>Return:</dt> |
|
262 <dd> |
|
263 Flag indicating a function / method with breakpoint |
|
264 </dd> |
|
265 </dl> |
|
266 <dl> |
|
267 <dt>Return Type:</dt> |
|
268 <dd> |
|
269 bool |
|
270 </dd> |
|
271 </dl> |
|
272 <a NAME="DebugBase.__disassemble" ID="DebugBase.__disassemble"></a> |
|
273 <h4>DebugBase.__disassemble</h4> |
|
274 <b>__disassemble</b>(<i>frame</i>) |
|
275 |
|
276 <p> |
|
277 Private method to generate a disassembly of the given code object. |
|
278 </p> |
|
279 <dl> |
|
280 |
|
281 <dt><i>frame</i> (code)</dt> |
|
282 <dd> |
|
283 frame object to be disassembled |
|
284 </dd> |
|
285 </dl> |
|
286 <dl> |
|
287 <dt>Return:</dt> |
|
288 <dd> |
|
289 dictionary containing the disassembly information |
|
290 </dd> |
|
291 </dl> |
|
292 <dl> |
|
293 <dt>Return Type:</dt> |
|
294 <dd> |
|
295 dict |
|
296 </dd> |
|
297 </dl> |
|
298 <a NAME="DebugBase.__do_clearBreak" ID="DebugBase.__do_clearBreak"></a> |
|
299 <h4>DebugBase.__do_clearBreak</h4> |
|
300 <b>__do_clearBreak</b>(<i>filename, lineno</i>) |
|
301 |
|
302 <p> |
|
303 Private method called to clear a temporary breakpoint. |
|
304 </p> |
|
305 <dl> |
|
306 |
|
307 <dt><i>filename</i> (str)</dt> |
|
308 <dd> |
|
309 name of the file the bp belongs to |
|
310 </dd> |
|
311 <dt><i>lineno</i> (int)</dt> |
|
312 <dd> |
|
313 linenumber of the bp |
|
314 </dd> |
|
315 </dl> |
|
316 <a NAME="DebugBase.__do_clearWatch" ID="DebugBase.__do_clearWatch"></a> |
|
317 <h4>DebugBase.__do_clearWatch</h4> |
|
318 <b>__do_clearWatch</b>(<i>cond</i>) |
|
319 |
|
320 <p> |
|
321 Private method called to clear a temporary watch expression. |
|
322 </p> |
|
323 <dl> |
|
324 |
|
325 <dt><i>cond</i> (str)</dt> |
|
326 <dd> |
|
327 expression of the watch expression to be cleared |
|
328 </dd> |
|
329 </dl> |
|
330 <a NAME="DebugBase.__eventPollTimer" ID="DebugBase.__eventPollTimer"></a> |
|
331 <h4>DebugBase.__eventPollTimer</h4> |
|
332 <b>__eventPollTimer</b>(<i></i>) |
|
333 |
|
334 <p> |
|
335 Private method to set a flag every 0.5 s to check for new messages. |
|
336 </p> |
|
337 <a NAME="DebugBase.__extractExceptionName" ID="DebugBase.__extractExceptionName"></a> |
|
338 <h4>DebugBase.__extractExceptionName</h4> |
|
339 <b>__extractExceptionName</b>(<i>exctype</i>) |
|
340 |
|
341 <p> |
|
342 Private method to extract the exception name given the exception |
|
343 type object. |
|
344 </p> |
|
345 <dl> |
|
346 |
|
347 <dt><i>exctype</i></dt> |
|
348 <dd> |
|
349 type of the exception |
|
350 </dd> |
|
351 </dl> |
|
352 <dl> |
|
353 <dt>Return:</dt> |
|
354 <dd> |
|
355 exception name (string) |
|
356 </dd> |
|
357 </dl> |
|
358 <a NAME="DebugBase.__extractSystemExitMessage" ID="DebugBase.__extractSystemExitMessage"></a> |
|
359 <h4>DebugBase.__extractSystemExitMessage</h4> |
|
360 <b>__extractSystemExitMessage</b>(<i>excinfo</i>) |
|
361 |
|
362 <p> |
|
363 Private method to get the SystemExit code and message. |
|
364 </p> |
|
365 <dl> |
|
366 |
|
367 <dt><i>excinfo</i> (tuple(Exception, excval object, traceback frame object))</dt> |
|
368 <dd> |
|
369 details about the SystemExit exception |
|
370 </dd> |
|
371 </dl> |
|
372 <dl> |
|
373 <dt>Return:</dt> |
|
374 <dd> |
|
375 SystemExit code and message |
|
376 </dd> |
|
377 </dl> |
|
378 <dl> |
|
379 <dt>Return Type:</dt> |
|
380 <dd> |
|
381 int, str |
|
382 </dd> |
|
383 </dl> |
|
384 <a NAME="DebugBase.__extract_stack" ID="DebugBase.__extract_stack"></a> |
|
385 <h4>DebugBase.__extract_stack</h4> |
|
386 <b>__extract_stack</b>(<i>exctb</i>) |
|
387 |
|
388 <p> |
|
389 Private member to return a list of stack frames. |
|
390 </p> |
|
391 <dl> |
|
392 |
|
393 <dt><i>exctb</i></dt> |
|
394 <dd> |
|
395 exception traceback |
|
396 </dd> |
|
397 </dl> |
|
398 <dl> |
|
399 <dt>Return:</dt> |
|
400 <dd> |
|
401 list of stack frames |
|
402 </dd> |
|
403 </dl> |
|
404 <a NAME="DebugBase.__sendCallTrace" ID="DebugBase.__sendCallTrace"></a> |
|
405 <h4>DebugBase.__sendCallTrace</h4> |
|
406 <b>__sendCallTrace</b>(<i>event, fromFrame, toFrame</i>) |
|
407 |
|
408 <p> |
|
409 Private method to send a call/return trace. |
|
410 </p> |
|
411 <dl> |
|
412 |
|
413 <dt><i>event</i> (str)</dt> |
|
414 <dd> |
|
415 trace event |
|
416 </dd> |
|
417 <dt><i>fromFrame</i> (frame object)</dt> |
|
418 <dd> |
|
419 originating frame |
|
420 </dd> |
|
421 <dt><i>toFrame</i> (frame object)</dt> |
|
422 <dd> |
|
423 destination frame |
|
424 </dd> |
|
425 </dl> |
|
426 <a NAME="DebugBase.__skipFrame" ID="DebugBase.__skipFrame"></a> |
|
427 <h4>DebugBase.__skipFrame</h4> |
|
428 <b>__skipFrame</b>(<i>frame</i>) |
|
429 |
|
430 <p> |
|
431 Private method to filter out debugger files. |
|
432 </p> |
|
433 <p> |
|
434 Tracing is turned off for files that are part of the |
|
435 debugger that are called from the application being debugged. |
|
436 </p> |
|
437 <dl> |
|
438 |
|
439 <dt><i>frame</i> (frame object)</dt> |
|
440 <dd> |
|
441 the frame object |
|
442 </dd> |
|
443 </dl> |
|
444 <dl> |
|
445 <dt>Return:</dt> |
|
446 <dd> |
|
447 flag indicating whether the debugger should skip this frame |
|
448 </dd> |
|
449 </dl> |
|
450 <dl> |
|
451 <dt>Return Type:</dt> |
|
452 <dd> |
|
453 bool |
|
454 </dd> |
|
455 </dl> |
|
456 <a NAME="DebugBase._set_stopinfo" ID="DebugBase._set_stopinfo"></a> |
|
457 <h4>DebugBase._set_stopinfo</h4> |
|
458 <b>_set_stopinfo</b>(<i>stopframe, returnframe, stoplineno=0</i>) |
|
459 |
|
460 <p> |
|
461 Protected method to update the frame pointers. |
|
462 </p> |
|
463 <dl> |
|
464 |
|
465 <dt><i>stopframe</i> (frame object)</dt> |
|
466 <dd> |
|
467 the frame object where to stop |
|
468 </dd> |
|
469 <dt><i>returnframe</i> (frame object)</dt> |
|
470 <dd> |
|
471 the frame object where to stop on a function return |
|
472 </dd> |
|
473 <dt><i>stoplineno</i> (int)</dt> |
|
474 <dd> |
|
475 line number to stop at. If stoplineno is greater than |
|
476 or equal to 0, then stop at line greater than or equal to the |
|
477 stopline. If stoplineno is -1, then don't stop at all. |
|
478 </dd> |
|
479 </dl> |
|
480 <a NAME="DebugBase.bootstrap" ID="DebugBase.bootstrap"></a> |
|
481 <h4>DebugBase.bootstrap</h4> |
|
482 <b>bootstrap</b>(<i>target, args, kwargs</i>) |
|
483 |
|
484 <p> |
|
485 Public method to bootstrap a thread. |
|
486 </p> |
|
487 <p> |
|
488 It wraps the call to the user function to enable tracing |
|
489 before hand. |
|
490 </p> |
|
491 <dl> |
|
492 |
|
493 <dt><i>target</i> (function pointer)</dt> |
|
494 <dd> |
|
495 function which is called in the new created thread |
|
496 </dd> |
|
497 <dt><i>args</i> (tuple)</dt> |
|
498 <dd> |
|
499 arguments to pass to target |
|
500 </dd> |
|
501 <dt><i>kwargs</i> (dict)</dt> |
|
502 <dd> |
|
503 keyword arguments to pass to target |
|
504 </dd> |
|
505 </dl> |
|
506 <a NAME="DebugBase.break_here" ID="DebugBase.break_here"></a> |
|
507 <h4>DebugBase.break_here</h4> |
|
508 <b>break_here</b>(<i>frame</i>) |
|
509 |
|
510 <p> |
|
511 Public method reimplemented from bdb.py to fix the filename from the |
|
512 frame. |
|
513 </p> |
|
514 <p> |
|
515 See fix_frame_filename for more info. |
|
516 </p> |
|
517 <dl> |
|
518 |
|
519 <dt><i>frame</i> (frame object)</dt> |
|
520 <dd> |
|
521 the frame object |
|
522 </dd> |
|
523 </dl> |
|
524 <dl> |
|
525 <dt>Return:</dt> |
|
526 <dd> |
|
527 flag indicating the break status |
|
528 </dd> |
|
529 </dl> |
|
530 <dl> |
|
531 <dt>Return Type:</dt> |
|
532 <dd> |
|
533 bool |
|
534 </dd> |
|
535 </dl> |
|
536 <a NAME="DebugBase.fix_frame_filename" ID="DebugBase.fix_frame_filename"></a> |
|
537 <h4>DebugBase.fix_frame_filename</h4> |
|
538 <b>fix_frame_filename</b>(<i>frame</i>) |
|
539 |
|
540 <p> |
|
541 Public method used to fixup the filename for a given frame. |
|
542 </p> |
|
543 <p> |
|
544 The logic employed here is that if a module was loaded |
|
545 from a .pyc file, then the correct .py to operate with |
|
546 should be in the same path as the .pyc. The reason this |
|
547 logic is needed is that when a .pyc file is generated, the |
|
548 filename embedded and thus what is readable in the code object |
|
549 of the frame object is the fully qualified filepath when the |
|
550 pyc is generated. If files are moved from machine to machine |
|
551 this can break debugging as the .pyc will refer to the .py |
|
552 on the original machine. Another case might be sharing |
|
553 code over a network... This logic deals with that. |
|
554 </p> |
|
555 <dl> |
|
556 |
|
557 <dt><i>frame</i> (frame object)</dt> |
|
558 <dd> |
|
559 the frame object |
|
560 </dd> |
|
561 </dl> |
|
562 <dl> |
|
563 <dt>Return:</dt> |
|
564 <dd> |
|
565 fixed up file name |
|
566 </dd> |
|
567 </dl> |
|
568 <dl> |
|
569 <dt>Return Type:</dt> |
|
570 <dd> |
|
571 str |
|
572 </dd> |
|
573 </dl> |
|
574 <a NAME="DebugBase.getCurrentFrame" ID="DebugBase.getCurrentFrame"></a> |
|
575 <h4>DebugBase.getCurrentFrame</h4> |
|
576 <b>getCurrentFrame</b>(<i></i>) |
|
577 |
|
578 <p> |
|
579 Public method to return the current frame. |
|
580 </p> |
|
581 <dl> |
|
582 <dt>Return:</dt> |
|
583 <dd> |
|
584 the current frame |
|
585 </dd> |
|
586 </dl> |
|
587 <dl> |
|
588 <dt>Return Type:</dt> |
|
589 <dd> |
|
590 frame object |
|
591 </dd> |
|
592 </dl> |
|
593 <a NAME="DebugBase.getFrameLocals" ID="DebugBase.getFrameLocals"></a> |
|
594 <h4>DebugBase.getFrameLocals</h4> |
|
595 <b>getFrameLocals</b>(<i>frmnr=0</i>) |
|
596 |
|
597 <p> |
|
598 Public method to return the locals dictionary of the current frame |
|
599 or a frame below. |
|
600 </p> |
|
601 <dl> |
|
602 |
|
603 <dt><i>frmnr</i></dt> |
|
604 <dd> |
|
605 distance of frame to get locals dictionary of. 0 is |
|
606 the current frame (int) |
|
607 </dd> |
|
608 </dl> |
|
609 <dl> |
|
610 <dt>Return:</dt> |
|
611 <dd> |
|
612 locals dictionary of the frame |
|
613 </dd> |
|
614 </dl> |
|
615 <a NAME="DebugBase.getStack" ID="DebugBase.getStack"></a> |
|
616 <h4>DebugBase.getStack</h4> |
|
617 <b>getStack</b>(<i>frame=None, applyTrace=False</i>) |
|
618 |
|
619 <p> |
|
620 Public method to get the stack. |
|
621 </p> |
|
622 <dl> |
|
623 |
|
624 <dt><i>frame</i> (frame object or list)</dt> |
|
625 <dd> |
|
626 frame object to inspect |
|
627 </dd> |
|
628 <dt><i>applyTrace</i> (bool)</dt> |
|
629 <dd> |
|
630 flag to assign trace function to fr.f_trace |
|
631 </dd> |
|
632 </dl> |
|
633 <dl> |
|
634 <dt>Return:</dt> |
|
635 <dd> |
|
636 list of lists with file name (string), line number (integer) |
|
637 and function name (string) |
|
638 </dd> |
|
639 </dl> |
|
640 <a NAME="DebugBase.go" ID="DebugBase.go"></a> |
|
641 <h4>DebugBase.go</h4> |
|
642 <b>go</b>(<i>special</i>) |
|
643 |
|
644 <p> |
|
645 Public method to resume the thread. |
|
646 </p> |
|
647 <p> |
|
648 It resumes the thread stopping only at breakpoints or exceptions. |
|
649 </p> |
|
650 <dl> |
|
651 |
|
652 <dt><i>special</i></dt> |
|
653 <dd> |
|
654 flag indicating a special continue operation |
|
655 </dd> |
|
656 </dl> |
|
657 <a NAME="DebugBase.move_instruction_pointer" ID="DebugBase.move_instruction_pointer"></a> |
|
658 <h4>DebugBase.move_instruction_pointer</h4> |
|
659 <b>move_instruction_pointer</b>(<i>lineno</i>) |
|
660 |
|
661 <p> |
|
662 Public method to move the instruction pointer to another line. |
|
663 </p> |
|
664 <dl> |
|
665 |
|
666 <dt><i>lineno</i> (int)</dt> |
|
667 <dd> |
|
668 new line number |
|
669 </dd> |
|
670 </dl> |
|
671 <a NAME="DebugBase.profile" ID="DebugBase.profile"></a> |
|
672 <h4>DebugBase.profile</h4> |
|
673 <b>profile</b>(<i>frame, event, arg</i>) |
|
674 |
|
675 <p> |
|
676 Public method used to trace some stuff independent of the debugger |
|
677 trace function. |
|
678 </p> |
|
679 <dl> |
|
680 |
|
681 <dt><i>frame</i> (frame object)</dt> |
|
682 <dd> |
|
683 current stack frame |
|
684 </dd> |
|
685 <dt><i>event</i> (str)</dt> |
|
686 <dd> |
|
687 trace event |
|
688 </dd> |
|
689 <dt><i>arg</i> (depends on the previous event parameter)</dt> |
|
690 <dd> |
|
691 arguments |
|
692 </dd> |
|
693 </dl> |
|
694 <a NAME="DebugBase.profileWithRecursion" ID="DebugBase.profileWithRecursion"></a> |
|
695 <h4>DebugBase.profileWithRecursion</h4> |
|
696 <b>profileWithRecursion</b>(<i>frame, event, arg</i>) |
|
697 |
|
698 <p> |
|
699 Public method used to trace some stuff independent of the debugger |
|
700 trace function. |
|
701 </p> |
|
702 <dl> |
|
703 |
|
704 <dt><i>frame</i> (frame object)</dt> |
|
705 <dd> |
|
706 current stack frame |
|
707 </dd> |
|
708 <dt><i>event</i> (str)</dt> |
|
709 <dd> |
|
710 trace event |
|
711 </dd> |
|
712 <dt><i>arg</i> (depends on the previous event parameter)</dt> |
|
713 <dd> |
|
714 arguments |
|
715 </dd> |
|
716 </dl> |
|
717 <dl> |
|
718 |
|
719 <dt>Raises <b>RuntimeError</b>:</dt> |
|
720 <dd> |
|
721 raised to indicate too many recursions |
|
722 </dd> |
|
723 </dl> |
|
724 <a NAME="DebugBase.run" ID="DebugBase.run"></a> |
|
725 <h4>DebugBase.run</h4> |
|
726 <b>run</b>(<i>cmd, globalsDict=None, localsDict=None, debug=True, closeSession=True</i>) |
|
727 |
|
728 <p> |
|
729 Public method to start a given command under debugger control. |
|
730 </p> |
|
731 <dl> |
|
732 |
|
733 <dt><i>cmd</i> (str or CodeType)</dt> |
|
734 <dd> |
|
735 command / code to execute under debugger control |
|
736 </dd> |
|
737 <dt><i>globalsDict</i> (dict)</dt> |
|
738 <dd> |
|
739 dictionary of global variables for cmd |
|
740 </dd> |
|
741 <dt><i>localsDict</i> (dict)</dt> |
|
742 <dd> |
|
743 dictionary of local variables for cmd |
|
744 </dd> |
|
745 <dt><i>debug</i> (bool)</dt> |
|
746 <dd> |
|
747 flag if command should run under debugger control |
|
748 </dd> |
|
749 <dt><i>closeSession</i> (bool)</dt> |
|
750 <dd> |
|
751 flag indicating to close the debugger session |
|
752 at exit |
|
753 </dd> |
|
754 </dl> |
|
755 <dl> |
|
756 <dt>Return:</dt> |
|
757 <dd> |
|
758 exit code of the program |
|
759 </dd> |
|
760 </dl> |
|
761 <dl> |
|
762 <dt>Return Type:</dt> |
|
763 <dd> |
|
764 int |
|
765 </dd> |
|
766 </dl> |
|
767 <a NAME="DebugBase.setRecursionDepth" ID="DebugBase.setRecursionDepth"></a> |
|
768 <h4>DebugBase.setRecursionDepth</h4> |
|
769 <b>setRecursionDepth</b>(<i>frame</i>) |
|
770 |
|
771 <p> |
|
772 Public method to determine the current recursion depth. |
|
773 </p> |
|
774 <dl> |
|
775 |
|
776 <dt><i>frame</i></dt> |
|
777 <dd> |
|
778 The current stack frame. |
|
779 </dd> |
|
780 </dl> |
|
781 <a NAME="DebugBase.set_continue" ID="DebugBase.set_continue"></a> |
|
782 <h4>DebugBase.set_continue</h4> |
|
783 <b>set_continue</b>(<i>special</i>) |
|
784 |
|
785 <p> |
|
786 Public method to stop only on next breakpoint. |
|
787 </p> |
|
788 <dl> |
|
789 |
|
790 <dt><i>special</i> (bool)</dt> |
|
791 <dd> |
|
792 flag indicating a special continue operation |
|
793 </dd> |
|
794 </dl> |
|
795 <a NAME="DebugBase.set_next" ID="DebugBase.set_next"></a> |
|
796 <h4>DebugBase.set_next</h4> |
|
797 <b>set_next</b>(<i>frame</i>) |
|
798 |
|
799 <p> |
|
800 Public method to stop on the next line in or below the given frame. |
|
801 </p> |
|
802 <dl> |
|
803 |
|
804 <dt><i>frame</i> (frame object)</dt> |
|
805 <dd> |
|
806 the frame object |
|
807 </dd> |
|
808 </dl> |
|
809 <a NAME="DebugBase.set_quit" ID="DebugBase.set_quit"></a> |
|
810 <h4>DebugBase.set_quit</h4> |
|
811 <b>set_quit</b>(<i></i>) |
|
812 |
|
813 <p> |
|
814 Public method to quit. |
|
815 </p> |
|
816 <p> |
|
817 Disables the trace functions and resets all frame pointer. |
|
818 </p> |
|
819 <a NAME="DebugBase.set_return" ID="DebugBase.set_return"></a> |
|
820 <h4>DebugBase.set_return</h4> |
|
821 <b>set_return</b>(<i>frame</i>) |
|
822 |
|
823 <p> |
|
824 Public method to stop when returning from the given frame. |
|
825 </p> |
|
826 <dl> |
|
827 |
|
828 <dt><i>frame</i> (frame object)</dt> |
|
829 <dd> |
|
830 the frame object |
|
831 </dd> |
|
832 </dl> |
|
833 <a NAME="DebugBase.set_step" ID="DebugBase.set_step"></a> |
|
834 <h4>DebugBase.set_step</h4> |
|
835 <b>set_step</b>(<i></i>) |
|
836 |
|
837 <p> |
|
838 Public method to stop after one line of code. |
|
839 </p> |
|
840 <a NAME="DebugBase.set_trace" ID="DebugBase.set_trace"></a> |
|
841 <h4>DebugBase.set_trace</h4> |
|
842 <b>set_trace</b>(<i>frame=None</i>) |
|
843 |
|
844 <p> |
|
845 Public method to start debugging from 'frame'. |
|
846 </p> |
|
847 <p> |
|
848 If frame is not specified, debugging starts from caller's frame. |
|
849 Because of jump optimizations it's not possible to use sys.breakpoint() |
|
850 as last instruction in a function or method. |
|
851 </p> |
|
852 <dl> |
|
853 |
|
854 <dt><i>frame</i> (frame object)</dt> |
|
855 <dd> |
|
856 frame to start debugging from |
|
857 </dd> |
|
858 </dl> |
|
859 <a NAME="DebugBase.set_until" ID="DebugBase.set_until"></a> |
|
860 <h4>DebugBase.set_until</h4> |
|
861 <b>set_until</b>(<i>frame=None, lineno=None</i>) |
|
862 |
|
863 <p> |
|
864 Public method to stop when the line with the lineno greater than the |
|
865 current one is reached or when returning from current frame. |
|
866 </p> |
|
867 <dl> |
|
868 |
|
869 <dt><i>frame</i> (frame object)</dt> |
|
870 <dd> |
|
871 reference to the frame object |
|
872 </dd> |
|
873 <dt><i>lineno</i> (int)</dt> |
|
874 <dd> |
|
875 line number to continue to |
|
876 </dd> |
|
877 </dl> |
|
878 <a NAME="DebugBase.step" ID="DebugBase.step"></a> |
|
879 <h4>DebugBase.step</h4> |
|
880 <b>step</b>(<i>traceMode</i>) |
|
881 |
|
882 <p> |
|
883 Public method to perform a step operation in this thread. |
|
884 </p> |
|
885 <dl> |
|
886 |
|
887 <dt><i>traceMode</i></dt> |
|
888 <dd> |
|
889 If it is True, then the step is a step into, |
|
890 otherwise it is a step over. |
|
891 </dd> |
|
892 </dl> |
|
893 <a NAME="DebugBase.stepOut" ID="DebugBase.stepOut"></a> |
|
894 <h4>DebugBase.stepOut</h4> |
|
895 <b>stepOut</b>(<i></i>) |
|
896 |
|
897 <p> |
|
898 Public method to perform a step out of the current call. |
|
899 </p> |
|
900 <a NAME="DebugBase.stop_here" ID="DebugBase.stop_here"></a> |
|
901 <h4>DebugBase.stop_here</h4> |
|
902 <b>stop_here</b>(<i>frame</i>) |
|
903 |
|
904 <p> |
|
905 Public method reimplemented to filter out debugger files. |
|
906 </p> |
|
907 <p> |
|
908 Tracing is turned off for files that are part of the |
|
909 debugger that are called from the application being debugged. |
|
910 </p> |
|
911 <dl> |
|
912 |
|
913 <dt><i>frame</i> (frame object)</dt> |
|
914 <dd> |
|
915 the frame object |
|
916 </dd> |
|
917 </dl> |
|
918 <dl> |
|
919 <dt>Return:</dt> |
|
920 <dd> |
|
921 flag indicating whether the debugger should stop here |
|
922 </dd> |
|
923 </dl> |
|
924 <dl> |
|
925 <dt>Return Type:</dt> |
|
926 <dd> |
|
927 bool |
|
928 </dd> |
|
929 </dl> |
|
930 <a NAME="DebugBase.storeFrameLocals" ID="DebugBase.storeFrameLocals"></a> |
|
931 <h4>DebugBase.storeFrameLocals</h4> |
|
932 <b>storeFrameLocals</b>(<i>frmnr=0</i>) |
|
933 |
|
934 <p> |
|
935 Public method to store the locals into the frame, so an access to |
|
936 frame.f_locals returns the last data. |
|
937 </p> |
|
938 <dl> |
|
939 |
|
940 <dt><i>frmnr</i></dt> |
|
941 <dd> |
|
942 distance of frame to store locals dictionary to. 0 is |
|
943 the current frame (int) |
|
944 </dd> |
|
945 </dl> |
|
946 <a NAME="DebugBase.tracePythonLibs" ID="DebugBase.tracePythonLibs"></a> |
|
947 <h4>DebugBase.tracePythonLibs</h4> |
|
948 <b>tracePythonLibs</b>(<i>enable</i>) |
|
949 |
|
950 <p> |
|
951 Public method to update the settings to trace into Python libraries. |
|
952 </p> |
|
953 <dl> |
|
954 |
|
955 <dt><i>enable</i> (bool)</dt> |
|
956 <dd> |
|
957 flag to debug into Python libraries |
|
958 </dd> |
|
959 </dl> |
|
960 <a NAME="DebugBase.trace_dispatch" ID="DebugBase.trace_dispatch"></a> |
|
961 <h4>DebugBase.trace_dispatch</h4> |
|
962 <b>trace_dispatch</b>(<i>frame, event, arg</i>) |
|
963 |
|
964 <p> |
|
965 Public method reimplemented from bdb.py to do some special things. |
|
966 </p> |
|
967 <p> |
|
968 This specialty is to check the connection to the debug server |
|
969 for new events (i.e. new breakpoints) while we are going through |
|
970 the code. |
|
971 </p> |
|
972 <dl> |
|
973 |
|
974 <dt><i>frame</i> (frame object)</dt> |
|
975 <dd> |
|
976 The current stack frame |
|
977 </dd> |
|
978 <dt><i>event</i> (str)</dt> |
|
979 <dd> |
|
980 The trace event |
|
981 </dd> |
|
982 <dt><i>arg</i> (depends on the previous event parameter)</dt> |
|
983 <dd> |
|
984 The arguments |
|
985 </dd> |
|
986 </dl> |
|
987 <dl> |
|
988 <dt>Return:</dt> |
|
989 <dd> |
|
990 local trace function |
|
991 </dd> |
|
992 </dl> |
|
993 <dl> |
|
994 <dt>Return Type:</dt> |
|
995 <dd> |
|
996 trace function or None |
|
997 </dd> |
|
998 </dl> |
|
999 <dl> |
|
1000 |
|
1001 <dt>Raises <b>SystemExit</b>:</dt> |
|
1002 <dd> |
|
1003 |
|
1004 </dd> |
|
1005 </dl> |
|
1006 <a NAME="DebugBase.user_exception" ID="DebugBase.user_exception"></a> |
|
1007 <h4>DebugBase.user_exception</h4> |
|
1008 <b>user_exception</b>(<i>excinfo, unhandled=False</i>) |
|
1009 |
|
1010 <p> |
|
1011 Public method reimplemented to report an exception to the debug server. |
|
1012 </p> |
|
1013 <dl> |
|
1014 |
|
1015 <dt><i>excinfo</i> (tuple(Exception, excval object, traceback frame object))</dt> |
|
1016 <dd> |
|
1017 details about the exception |
|
1018 </dd> |
|
1019 <dt><i>unhandled</i> (bool)</dt> |
|
1020 <dd> |
|
1021 flag indicating an uncaught exception |
|
1022 </dd> |
|
1023 </dl> |
|
1024 <a NAME="DebugBase.user_line" ID="DebugBase.user_line"></a> |
|
1025 <h4>DebugBase.user_line</h4> |
|
1026 <b>user_line</b>(<i>frame</i>) |
|
1027 |
|
1028 <p> |
|
1029 Public method reimplemented to handle the program about to execute a |
|
1030 particular line. |
|
1031 </p> |
|
1032 <dl> |
|
1033 |
|
1034 <dt><i>frame</i></dt> |
|
1035 <dd> |
|
1036 the frame object |
|
1037 </dd> |
|
1038 </dl> |
|
1039 <div align="right"><a href="#top">Up</a></div> |
|
1040 <hr /> |
|
1041 <hr /> |
|
1042 <a NAME="printerr" ID="printerr"></a> |
|
1043 <h2>printerr</h2> |
|
1044 <b>printerr</b>(<i>s</i>) |
|
1045 |
|
1046 <p> |
|
1047 Module function used for debugging the debug client. |
|
1048 </p> |
|
1049 <dl> |
|
1050 |
|
1051 <dt><i>s</i></dt> |
|
1052 <dd> |
|
1053 data to be printed |
|
1054 </dd> |
|
1055 </dl> |
|
1056 <div align="right"><a href="#top">Up</a></div> |
|
1057 <hr /> |
|
1058 <hr /> |
|
1059 <a NAME="setRecursionLimit" ID="setRecursionLimit"></a> |
|
1060 <h2>setRecursionLimit</h2> |
|
1061 <b>setRecursionLimit</b>(<i>limit</i>) |
|
1062 |
|
1063 <p> |
|
1064 Module function to set the recursion limit. |
|
1065 </p> |
|
1066 <dl> |
|
1067 |
|
1068 <dt><i>limit</i></dt> |
|
1069 <dd> |
|
1070 recursion limit (integer) |
|
1071 </dd> |
|
1072 </dl> |
|
1073 <div align="right"><a href="#top">Up</a></div> |
|
1074 <hr /> |
|
1075 </body></html> |